SYSTEM$LOCATE_DBT_ARTIFACTS

functionsupportedContainer services & dev tooling

docs.snowflake.com ↗

System functions

Returns the location of artifacts from a specified dbt project object run (for example, manifest.json). Use this function with the DBT_PROJECT_EXECUTION_HISTORY function to access dbt artifacts and logs programmatically.

Syntax

SYSTEM$LOCATE_DBT_ARTIFACTS ( '<query_id>' )

Parameters

NameRequiredDescription
query_idrequiredThe query ID of the dbt project object run whose files you want to locate.

Returns

The function returns the file path for dbt project object artifacts from a run (for example, snow://dbt/DBTEST.PUBLIC.MY_DBT_PROJECT/results/query_id_01bf3f5a-010b-4d87-0000-53493abb7cce/). For more information and examples, see Access dbt artifacts and logs programmatically. This is the results directory for the specified query, not a search for the latest execution. Its standalone target files can include manifest.json, semantic_manifest.json, run_results.json, and sources.json when present, and logs/dbt.log contains the current execution’s log. For the complete directory layout, see Results directory contents. The function returns a location. Use LIST to inspect the returned location or GET to download files. When used in the IMPORTS clause of EXECUTE DBT PROJECT, SYSTEM$LOCATE_DBT_ARTIFACTS imports the results directory, including dbt_artifacts.zip, but doesn’t extract the ZIP file. When you import the location AS 'state', Snowflake mounts the query’s results directory at ./imports/state, with the dbt artifacts in ./imports/state/target. Use SYSTEM$LOCATE_DBT_ARCHIVE directly when you need the archived target and logs, such as compiled SQL. Snowflake extracts the archive automatically.

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.