Snowflake의 dbt 프로젝트

`dbt Core`_는 SQL 변환을 정의, 테스트, 배포하는 데 사용할 수 있는 오픈 소스 데이터 변환 도구 및 프레임워크입니다.

dbt Projects on Snowflake 를 사용하면 일반적으로 다음과 같이 익숙한 Snowflake 기능을 사용하여 dbt Core 프로젝트를 생성, 편집, 테스트, 실행, 관리할 수 있습니다.

  1. 유효한 dbt 프로젝트로 시작: (dbt_project.yml, profile.yml, /models/... 사용) 이는 Snowsight 의 작업 공간 또는 Snowflake에 연결한 Git 리포지토리에 저장됩니다. :doc:`필요한 권한</user-guide/data-engineering/dbt-projects-on-snowflake-access-control>`이 있는 역할로 데이터베이스, 스키마 및 웨어하우스를 준비합니다.

  2. 종속성 설치: Snowflake 작업 공간, 로컬 컴퓨터 또는 git 오케스트레이터 내에서 dbt deps 명령을 실행하여 dbt 프로젝트의 dbt_packages 폴더를 채웁니다.

    자세한 내용은 Snowflake의 dbt 프로젝트에 대한 종속성 이해 섹션을 참조하십시오.

  3. DBT PROJECT 오브젝트 배포: 프로젝트 파일을 해당 오브젝트의 새 버전에 복사하여 스키마 수준 DBT PROJECT 오브젝트를 생성합니다. CREATE OR REPLACE DBT PROJECT … FROM <source> 명령 또는 snow dbt deploy Snowflake CLI 명령을 사용하여 이 작업을 수행할 수 있습니다.

    자세한 내용은 dbt 프로젝트 오브젝트 배포 섹션을 참조하십시오.

  4. Execute the deployed dbt project object: Execute a dbt Core project within a dbt project object by using the EXECUTE DBT PROJECT command or the snow dbt execute Snowflake CLI command. Executing a dbt project involves invoking dbt Core commands to build or test models; this is what you schedule and orchestrate.

    자세한 내용은 EXECUTE DBT PROJECT 섹션을 참조하십시오.

  5. Schedule with Snowflake tasks: Use Snowflake tasks to schedule and orchestrate dbt project object executions.

    자세한 내용은 Schedule execution of dbt project objects on Snowflake 섹션을 참조하십시오.

  6. CI/CD 통합 설정: Snowflake CLI 명령을 사용하여 배포 및 실행을 CI/CD 워크플로에 통합합니다.

    The Snowflake CLI supports commands to create, execute, and manage dbt project objects from the command line. This is useful for integrating dbt projects into your data engineering workflows and CI/CD pipelines. For more information, see Snowflake CLI, CI/CD 와 Snowflake CLI 통합하기, and snow dbt 명령.

  7. Monitor the dbt project object: Use Snowflake monitoring features to inspect, manage, and tune dbt project execution whether you execute a dbt project object manually or use tasks to execute dbt project objects on a schedule.

    자세한 내용은 dbt Projects on Snowflake 모니터링 섹션을 참조하십시오.

핵심 개념

  • dbt 프로젝트 오브젝트: *dbt 프로젝트*는 dbt_project.yml 파일과 모델 및 소스와 같은 dbt 자산을 정의하는 파일 세트가 포함된 디렉터리입니다. DBT PROJECT는 Snowflake의 dbt 프로젝트에 대한 버전이 지정된 소스 파일을 포함하는 스키마 수준 오브젝트입니다. dbt 프로젝트 오브젝트를 작업 공간에 연결하거나 작업 공간과 독립적으로 오브젝트를 생성하고 관리할 수 있습니다. Snowflake의 다른 스키마 수준 오브젝트와 같이 dbt 프로젝트 오브젝트를 CREATE, ALTER 및 DROP할 수 있습니다.

    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.

    자세한 내용은 Understand dbt project objects 섹션을 참조하십시오.

  • 스키마 사용자 지정: dbt는 기본 매크로 :code:`generate_schema_name`을 사용하여 모델이 빌드되는 위치를 결정합니다. dbt가 모델, 시드, 스냅샷, 테스트 테이블을 빌드하는 방법을 사용자 지정할 수 있습니다.

    자세한 내용은 Understand schema generation and customization 섹션을 참조하십시오.

  • 작업 공간: Snowflake 웹 인터페이스의 작업 공간은 Git 연결 웹 IDE로, 여기서 하나 이상의 dbt 프로젝트를 시각화, 테스트, 실행 및 스캐폴딩하고, 이를 Snowflake dbt 프로젝트 오브젝트에 연결하여 생성/업데이트하고, 한 곳에서 다른 Snowflake 코드를 편집할 수 있습니다.

    자세한 내용은 Workspaces for dbt Projects on Snowflake 섹션을 참조하십시오.

  • 버전 관리: 모든 dbt 프로젝트 오브젝트의 버전이 관리됩니다. 버전은 :samp:`snow://dbt/<db>.<schema>.<project>/versions/…`에 있습니다.

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

  • Supported dbt Core versions: Snowflake provides managed runtimes for specific dbt Core versions. You can pin a version at creation time, override it per execution, or set an account-level default.

    For more information, see dbt Projects on Snowflake 에 지원되는 dbt Core 버전.

  • Supported commands: dbt project objects support a subset of dbt commands and flags.

    For more information, see 지원되는 dbt 명령 및 플래그.