We’re looking to get some insight into user activity in Redash. When a user executes a query, it appears that query execution activity is being logged in two different ways. Sometimes it’s recorded as object_type = 'query' and action = 'execute', like I would expect. But more often, it’s showing up as object_type = 'data_source' and action = 'execute_query'
I’ve confirmed that when I go into a dashboard and click refresh on a widget, or view a query and click “Execute”, it’s being recorded in the events table as object_type = 'data_source' and action = 'execute_query'. This is less helpful, since it logs the id of the data source in this case, and not the id of the query. Meanwhile, the text of the executed query appears in the additional_properties field.
Can you help me understand this behavior, and what a good solution would be to identify the queries being used in these situations?
Thank much!
Technical details:
Redash Version: 9.0.0-beta (2641562b)
Browser/OS: 89.0.4389.114 (Official Build) (64-bit) / Windows 10 19042.867
This doesn’t make sense and shouldn’t be possible. From searching the source code, the only actions for query are
favorite
search
list
create
view
regnerate_api_key [typo?]
fork
load_favorites
Are you sure? The query ID is logged within additional properties also. Try running this query against your metadata DB and you’ll see the query id also:
SELECT additional_properties::JSON ->> 'query_id'
FROM EVENTS
WHERE action = 'execute_query'
AND additional_properties::JSON ->> 'query_id' <> 'adhoc'