About model query history beta
The model query history tile allows you to:
- View the query count for a model based on the data warehouse's query logs.
- Provides data teams insight, so they can focus their time and infrastructure spend on the worthwhile used data products.
- Enable analysts to find the most popular models used by other people.
Model query history is powered by a single query of the query log table in your data warehouse aggregated on a daily basis. It filters down to select
statements only to gauge model consumption and excludes dbt model build and test executions.
Prerequisites
To access the features, you should meet the following:
- You have a dbt Cloud account on the Enterprise plan.
- You have set up a production deployment environment for each project you want to explore, with at least one successful job run.
- You have admin permissions in dbt Cloud to edit project settings or production environment settings.
- Use Snowflake or BigQuery as your data warehouse and can enable query history permissions or work with an admin to do so (Support for additional data platforms coming soon).
Credential permissions
This section explains the permissions and steps you need to enable and view model query history in dbt Explorer.
The model query history feature uses the credentials in your production environment to gather metadata from your data warehouse’s query logs. This means you may need elevated permissions with the warehouse. Before making any changes to your data platform permissions, confirm the configured permissions in dbt Cloud:
- Navigate to Deploy and then Environments.
- Select the Environment marked PROD and click Settings.
- Look at the information under Deployment credentials.
- Note: Querying query history entails warehouse costs / uses credits.
-
Copy or cross reference those credential permissions with the warehouse permissions and grant your user the right permissions.
Enable query history in dbt Cloud
During beta, the dbt Labs team will manually enable query history for your dbt Cloud projects. Later on, you’ll be able to do it yourself.
View query history in Explorer
To enhance your discovery, you can view your model query history in various locations within dbt Explorer. For details on how to access model query history in each location, expand the following toggles:
View from Performance charts
- Navigate to dbt Explorer by clicking on the Explore link in the navigation.
- In the main Overview page, under Project click Performance and scroll down to view the most queried models
- Use the dropdown menu on the right to select the desired time period, with options available for up to the past 3 months.
- In the model performance tab, open the Usage chart to see queries over time for that model.
View from Project lineage
- To view your model in your project lineage, go to the main Overview page and click on Project lineage.
- In the lower left of your lineage, click on Lenses and select Usage queries.
- Your lineage should display a small red box above each model, indicating the usage query number for each model. The query number for each model represents the query history over the last 30 days.
View from Model list
- To view your model in your project lineage, go to the main Overview page.
- In the left navigation, go to the Resources tab and click on Models to view the models list.
- You can view the usage query count for the models and sort by most or least queried. The query number for each model represents the query history over the last 30 days.