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.

dbt 프로젝트 오브젝트가 업데이트되는 방법

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.

프로덕션 파이프라인을 생성하려면 dbt 프로젝트 오브젝트를 생성하고 :doc:`작업을 사용하여 실행을 예약</user-guide/data-engineering/dbt-projects-on-snowflake-schedule-project-execution>`하는 것이 좋습니다. 각 dbt 프로젝트 오브젝트 버전은 변경할 수 없으므로 누군가가 새 버전을 명시적으로 추가하지 않는 한, 실행 사이에 아무 것도 변경되지 않습니다.

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;

:code:`–force`를 사용하면 버전을 추가할 수 있습니다. 이 옵션을 사용하지 않을 경우 이미 생성된 오브젝트에 대해 CREATE DBT PROJECT를 실행하는 것과 같게 되며 실패합니다.

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