Schema:

ACCOUNT_USAGE

DBT_PROJECT_EXECUTION_HISTORY view

This Account Usage view displays the execution history of dbt Projects on Snowflake. The view retains data for 365 days (1 year).

See also:

DBT_PROJECT_EXECUTION_HISTORY (Information Schema table function)

Columns

Column NameData TypeDescription
QUERY_IDTEXTID of the query associated with the execution.
QUERY_START_TIMETIMESTAMP_LTZTime the execution started.
QUERY_END_TIMETIMESTAMP_LTZTime the execution ended.
USER_IDTEXTInternal/system-generated identifier for the user that initiated the execution. Empty for system-initiated runs.
USER_NAMETEXTName of the user that initiated the execution. Displays SYSTEM for system-initiated runs.
OBJECT_NAMETEXTName of the workspace or dbt project object the execution belonged to.
OBJECT_TYPETEXTType of object. Possible values:
- DBT_PROJECT
- WORKSPACE
DATABASE_IDTEXTInternal/system-generated identifier for the database containing the object.
DATABASE_NAMETEXTName of the database containing the object.
SCHEMA_IDTEXTInternal/system-generated identifier for the schema containing the object.
SCHEMA_NAMETEXTName of the schema containing the object.
WAREHOUSE_IDNUMBERInternal/system-generated identifier for the warehouse used for the execution.
WAREHOUSE_NAMETEXTName of the warehouse used for the execution.
COMMANDTEXTThe dbt command that was run.
ARGSTEXTThe arguments passed to the dbt command. For example, --target prod.
ERROR_CODETEXTError code for the execution, if applicable.
ERROR_MESSAGETEXTError message describing why the execution failed, if applicable.
STATETEXTState of the execution. Possible values include:
- SUCCESS
- HANDLED_ERROR
DBT_VERSIONTEXTThe dbt version used for the execution. For example, 1.10.15.
DBT_SNOWFLAKE_VERSIONTEXTThe version of the dbt-snowflake adapter used for the execution. For example, 1.10.3.
ENVIRONMENTTEXTThe environment (defined in the env.yml file) used for this run. For more information, see Using SQL environment variables and private Git packages for dbt Projects on Snowflake.

Usage notes

  • The latency for this view can be up to 120 minutes (2 hours).
  • Data is retained for 365 days (1 year).
  • This view includes executions from both dbt project objects and workspaces.
  • This view is queried with standard SQL WHERE clauses. It doesn’t support the => named-parameter filtering available in the Information Schema table function. If you only need the last 7 days of history, use the Information Schema table function instead.

Examples

Query recent executions for a specific dbt project object

SELECT
    object_name,
    object_type,
    command,
    args,
    state,
    query_start_time,
    query_end_time,
    user_name
FROM SNOWFLAKE.ACCOUNT_USAGE.DBT_PROJECT_EXECUTION_HISTORY
WHERE database_name = 'ANALYTICS_DB'
  AND schema_name = 'DBT_PROD'
  AND object_name = 'FINANCE_ANALYTICS'
ORDER BY query_start_time DESC
LIMIT 20;

Find failed executions for a specific dbt project object

SELECT
    object_name,
    database_name,
    schema_name,
    command,
    args,
    error_code,
    error_message,
    query_start_time,
    user_name
FROM SNOWFLAKE.ACCOUNT_USAGE.DBT_PROJECT_EXECUTION_HISTORY
WHERE state != 'SUCCESS'
  AND database_name = 'ANALYTICS_DB'
  AND schema_name = 'DBT_PROD'
ORDER BY query_start_time DESC;

Track dbt version usage across executions

SELECT
    dbt_version,
    dbt_snowflake_version,
    COUNT(*) AS execution_count,
    MIN(query_start_time) AS first_seen,
    MAX(query_start_time) AS last_seen
FROM SNOWFLAKE.ACCOUNT_USAGE.DBT_PROJECT_EXECUTION_HISTORY
GROUP BY dbt_version, dbt_snowflake_version
ORDER BY last_seen DESC;