Creating an SQL query from Data Explorer
Within Data Explorer, you can generate optimized SQL queries, based upon currently applied filter settings, using one of the Show query buttons. You can run these queries using Data Analyzer, enabling you to run optimized SQL queries on the data you have ingested into the Platform, based on the trends you have found using Data Explorer.
You can generate queries for:
- the key metric: this returns a single value for the selected key metric selected for display in the navigation bar (see Using a key metric)
- a data layer: this query returns results for all properties in the selected data layer, based upon the currently applied filter settings
- a property breakdown: this return results for the values displayed in the palette for the chosen property. Note: for categorical properties, any filter criteria on the selected property are ignored, so that the results returned by the Data Analyzer show the percentage values displayed in the palette
Generating an SQL query
To generate an SQL query from Data Explorer:
Click on the Show query button for key metric, layer or property; this example generates the SQL query for a layer:
Review the selected parameters and the generated SQL, then:
- click Save... to save this query and run it on the Data Analyzer later. From the Queries tab in the dashboard, you can open this query, and then run the query, or copy the SQL for use in another query
- click Save and run to save the query and to trigger the execution of this query on the Data Analyzer; you can monitor its progress from the Queries tab in the dashboard (see Running SQL queries from the dashboard)
- copy and paste the generated SQL it into your editor of choice, modify it or combine it with other SQL, and then run it using the Run a new query dialog in the dashboard Queries tab
Visibility of your queries
By default, all the SQL queries that you generate from Data Explorer are private, meaning that only you can see them.
To make a query public, open the query in the Queries tab and click Shared. This query now appears in the Queries tab of other Platform users who have permission to view your data views.
Monitoring the status of your SQL queries
To monitor your in-progress queries and see your saved queries, use the Queries tab in the dashboard; see Running SQL queries from the dashboard.