SYSTEM$GET_DBT_LOG

functionsupportedContainer services & dev tooling

docs.snowflake.com ↗

System functions

Returns logs for the specified run for a dbt Projects on Snowflake. Use this function with the DBT_PROJECT_EXECUTION_HISTORY function to access dbt artifacts and logs programmatically.

Syntax

supportedpartialnot supportednot scored

SYSTEM$GET_DBT_LOG ( '<query_id>' [ , <max_num_lines> ] )

Parameters

NameRequiredDescription
query_idrequiredQuery ID of the run that you want logs for.
max_num_linesrequiredOptional. Maximum number of lines to return from the end of the dbt.log file. Defaults to 1000. The combined size of the returned lines is capped at approximately 10 MB. If the lines you request exceed this limit, the function drops the oldest lines from the start of the result until it fits, so the output always reflects the most recent lines in the log.

Returns

The function returns up to max_num_lines lines from the end of the dbt.log file (1,000 lines by default). For full logs, download the archive ZIP file. For more information and examples, see Access dbt artifacts and logs programmatically.

Usage notes

Access control requirements

This function can only be used with dbt project objects, not Workspaces, when you have one of the following privileges: - OWNERSHIP, USAGE, or MONITOR on the dbt project object For details about these privileges, see dbt project object privileges. Operating on an object in a schema requires at least one privilege on the parent database and at least one privilege on the parent schema. For instructions on creating a custom role with a specified set of privileges, see Creating custom roles. For general information about roles and privilege grants for performing SQL actions on securable objects, see Overview of Access Control.