dbt Projects on Snowflake 모니터링¶
이 항목에서는 dbt Projects on Snowflake 에 대한 모니터링 기능을 사용하여 dbt 프로젝트 실행(수동 또는 작업 예약)을 검사하고 로그 및 아티팩트를 보는 방법에 대해 설명합니다.
섹션 |
설명 |
|---|---|
dbt 프로젝트 오브젝트와 이를 실행하는 예약된 작업에 대한 로깅 및 추적 이벤트를 캡처합니다. 이 기능을 활성화하려면 dbt 프로젝트 오브젝트와 작업이 배포되는 스키마에 로깅, 추적, 메트릭을 설정해야 합니다. |
|
Snowsight 의 탐색 메뉴에서 Transformation » :ui:`dbt Projects`를 선택하여 dbt 프로젝트 오브젝트에 대한 실행 기록, 작업 그래프, 쿼리 세부 정보를 볼 수 있습니다. 작업 일정에 따라 실행되는 dbt 프로젝트 오브젝트에 작업 공간이 연결되면 작업 공간 내에서 작업 실행 기록 및 작업 그래프를 열 수 있습니다. |
|
DBT_PROJECT_EXECUTION_HISTORY 테이블 함수 및 dbt 시스템 함수를 사용하여 dbt 아티팩트와 로그에 프로그래밍 방식으로 액세스합니다. |
Enable monitoring features for dbt project objects¶
dbt 프로젝트 오브젝트에 대한 모니터링 기능을 활성화하려면, dbt 프로젝트 오브젝트가 생성되는 데이터베이스 및 스키마에 LOG_LEVEL, TRACE_LEVEL, METRIC_LEVEL을 설정하세요. 다음 SQL 예제와 같습니다.
dbt 프로젝트 오브젝트의 예약된 실행 모니터링¶
If you execute a deployed dbt project object on a schedule using a task, and the task is in the same schema as the dbt project object, you can view scheduled tasks directly from the workspace by selecting Connect and then View Schedules.
참고
이 기능은 dbt 프로젝트 오브젝트에 연결된 작업 공간에만 사용할 수 있습니다.
작업 공간에서 dbt 프로젝트 오브젝트의 예약된 실행을 모니터링하려면:
From the dbt project menu on the right side of the project pane, under Scheduled runs, choose View schedules.
목록에서 검사할 일정(작업)을 선택한 다음, :ui:`View details`를 선택합니다.
The information pane for the task opens, where you can view Task details, the task Graph (if applicable), and Run History of this task. For more information, see View tasks and task graphs in Snowsight.
From the Run History for any scheduled dbt project object execution in the list, select the Open query history button on the far right to view query details, the query profile, and the query telemetry for the run. For more information, see 특정 쿼리의 세부 정보 및 프로필 검토하기.
Monitor dbt project objects in Snowsight¶
To view detailed monitoring information about dbt project object executions, navigate to Transformations » dbt Projects in Snowsight. You must use a role with the MONITOR privilege to view monitoring information for the dbt project object. For more information, see Snowflake의 dbt 프로젝트에 대한 액세스 제어.
In the navigation menu, select Transformation » dbt Projects. A histogram shows the frequency of dbt project object executions and a list of projects that have run.
The list of dbt project objects includes columns with the following information. You can filter the list by date range, command, and run status.
PROJECT - 선택한 기간 동안 dbt 프로젝트 오브젝트의 이름과 실행 횟수입니다.
LAST COMMAND - 마지막 실행 중에 실행된 dbt 명령입니다.
LAST RUN STATUS - 실행 결과: Succeeded, Executing 또는 :ui:`Failed`입니다.
LAST RUN - 마지막 실행 이후 경과된 시간입니다. 정렬 순서를 반대로 하려면 열 헤더를 선택하세요. 기본적으로 가장 최근 실행이 먼저 표시됩니다.
PREVIOUS RUNS - 선택한 기간의 상태별 실행 횟수입니다.
DATABASE 및 SCHEMA - dbt 프로젝트 오브젝트가 저장되는 데이터베이스 및 스키마입니다.
LAST RUN PARAMETERS - The dbt command-line arguments (ARGS) specified in the EXECUTE DBT PROJECT command for the last dbt project object execution.
개별 프로젝트 실행을 검사하려면 목록에서 dbt 프로젝트 오브젝트를 선택하세요.
The dbt project object details page in the database object explorer opens for that dbt project object.
The Run History tab is selected by default, with the following information for each job run in the selected time period:
COMMAND - 마지막 실행 중에 실행된 dbt 명령입니다.
STATUS - 실행 결과: Succeeded, Executing 또는 :ui:`Failed`입니다.
RUN TIME - 마지막 실행 이후 경과된 시간입니다. 정렬 순서를 반대로 하려면 열 헤더를 선택하세요. 기본적으로 가장 최근 실행이 먼저 표시됩니다.
PARAMETERS The dbt command-line arguments (ARGS) specified in the EXECUTE DBT PROJECT command for the last dbt project object execution.
To see details for a run, select it from the list.
The Query Details page opens for the EXECUTE DBT PROJECT query that ran. This page includes the following tabs:
Query Details - Displays the execution status, start time, end time, duration, warehouse size, query ID, and the SQL text of the EXECUTE DBT PROJECT command. Also shows per-model results for the dbt command that ran (for example,
build), including each model name, time taken, and status.Query Profile - Shows the query execution plan and performance statistics.
Query Telemetry - Shows telemetry data for the execution.
DAG - Visualizes the models that ran during the execution and their results. For more information, see 쿼리 내역 DAG 보기.
자세한 내용은 특정 쿼리의 세부 정보 및 프로필 검토하기 섹션을 참조하십시오.
쿼리 내역 DAG 보기¶
The Query Details for a dbt project object execution includes a DAG tab that visualizes what ran during an execution and the results for each model. This differs from the DAG on the project details page, which serves as a documentation layer for your project, including models, tests, sources, and their dependencies.
쿼리 내역 DAG는 실행 중에 생성된 manifest.json 및 run_results.json 아티팩트에서 빌드됩니다. DAG에서 노드를 선택하고 해당 특정 쿼리(쿼리가 실패한 경우 쿼리 ID 및 모든 오류 메시지 포함)에 대한 세부 정보가 포함된 측면 패널을 엽니다.
쿼리 내역 DAG를 보려면 다음을 수행합니다.
탐색 메뉴에서 Transformations » dbt Projects 를 선택합니다.
From the list of dbt project objects, select a project.
Run History 탭에서 실행을 선택하여 해당 실행에 대한 Query Details 를 엽니다.
DAG 탭을 선택합니다.
참고
쿼리 내역 DAG에 “사용 가능한 데이터 없음”이 표시되는 경우, run_results.json 이 생성되기 전에 실행이 실패했을 가능성이 큽니다. 자세한 내용은 쿼리 내역 DAG에 대한 제한 사항 섹션을 참조하십시오.
프로그래밍 방식으로 dbt 아티팩트 및 로그에 액세스¶
DBT_PROJECT_EXECUTION_HISTORY 테이블 함수 및 다음 시스템 함수를 사용하여 dbt 아티팩트 및 로그에 프로그래밍 방식으로 액세스합니다.
함수 |
반환 내용 |
일반적인 사용 |
참고 |
|---|---|---|---|
텍스트 로그 출력(실행의 로그 테일) |
SQL의 빠른 디버깅. 예를 들어, 파일을 다운로드하지 않고 오류 및 경고를 확인합니다. |
로그 내용을 반환하며, 아무것도 생성되거나 이동하지 않습니다. |
|
|
LIST, GET 또는 COPY FILES를 사용하여 특정 파일을 찾아보거나 복사합니다. |
로케이터(URL)일 뿐이며, 계속 GET/COPY FILES를 실행하여 가져옵니다. |
|
단일 ZIP 파일 URL(예: |
하나의 파일을 다운로드하려는 경우에 편리합니다(예: GET). |
:code:`GET ‘<url>’ file:///local/dir`을 사용하여 다운로드합니다. |
최신 dbt 프로젝트 쿼리의 로그 가져오기 및 ZIP 파일 다운로드하기¶
The following example queries Snowflake’s dbt execution history to show the most recent query ID for the dbt project object. It pulls the log output for that execution and returns the location of the zipped dbt artifacts for that execution.
Snowflake CLI 예제에서는 GET을 사용하여 아티팩트 ZIP 파일 또는 특정 파일(예: manifest.json)을 로컬 폴더로 다운로드합니다.
To download the ZIP file from Snowsight, navigate to Transformations » dbt Projects, select your project, then select an execution to navigate to Query Details, and select Download Build Artifacts under dbt Output.
You must use a role with the OWNERSHIP, USAGE, or MONITOR privilege on your dbt project objects.
팁
Use function arguments such as DATABASE, SCHEMA, and OBJECT_NAME to filter results whenever possible. These filters are applied before the RESULT_LIMIT (default: 100 rows), so using them ensures you get the most relevant results rather than filtering a potentially truncated result set with a WHERE clause.
To view the stage path where Snowflake stored the dbt project object execution artifacts, use the
SYSTEM$LOCATE_DBT_ARTIFACTS function. You can then use that path with GET or COPY FILES with the Snowflake CLI to download
things like manifest.json, compiled SQL, or logs.
You can also create a fresh internal stage, locate the Snowflake-managed path for the specified dbt project object execution’s artifacts, and copy those artifacts into your stage for retrieval, as shown in the following example: