Understand dbt project objects

A DBT PROJECT is a schema-level object that contains versioned source files for your dbt project in Snowflake. You can connect a dbt project object to a workspace, or you can create and manage the object independently of a workspace.

A dbt project object is typically based on a dbt project directory that contains a dbt_project.yml file. This is the pattern that Snowflake uses when you deploy (create) a dbt project object from within a workspace.

dbt project objects support role-based access control (RBAC). You can CREATE, ALTER, and DROP dbt project objects like other schema-level objects in Snowflake. You can use the EXECUTE DBT PROJECT command from a Snowflake warehouse to execute dbt commands like test and run. You can also use tasks to schedule execution of these commands.

So werden dbt-Projektobjekte aktualisiert

dbt project objects don’t automatically update as you edit the workspace. You must execute ALTER DBT PROJECT … ADD VERSION each time you want to redeploy and update the files of the dbt project object.

Um eine Produktionspipeline zu erstellen, empfehlen wir die Erstellung eines dbt-Projektobjekts und Planen seiner Ausführung mit einer Aufgabe. Da jede dbt-Projektobjektversion unveränderlich ist, wird dadurch sichergestellt, dass sich zwischen den Ausführungen nichts ändert, es sei denn, jemand fügt explizit eine neue Version hinzu.

To update the dbt project object’s files, you must add a new version in a workspace, for example:

ALTER DBT PROJECT testdbt.public.my_dbt_project_object
  ADD VERSION FROM 'snow://workspace/user$.public."all_my_dbt_projects"/versions/last';

If your dbt project object is backed by Git and you want to automate your testing and deployment, run the Snow CLI snow dbt deploy command with the --force option, as shown in the following example:

snow dbt deploy --source 'snow://workspace/user$.public."all_my_dbt_projects"/versions/last'  --force my_dbt_project;

--force ermöglicht es Ihnen, eine Version hinzuzufügen; ohne wäre es gleichbedeutend mit der Ausführung von CREATE DBT PROJECT für ein bereits erstelltes Objekt, was fehlschlagen würde.

For more information about versioning, see Versions for dbt project objects and files.