dbt debug 명령어

dbt debug 명령어

dbt debug는 데이터베이스 연결을 테스트하고 시스템 설정을 확인하는 유틸리티예요. 프로젝트 파일 유효성, dbt 버전, 필수 의존성 설치 여부 등을 여러 축에서 점검해서 dbt 명령어 실행 전 잠재적 문제를 찾아줘요.

출처: 문서

본문

dbt debug는 데이터베이스 연결을 테스트하고 디버깅 목적의 정보를 표시하는 유틸리티 함수예요. 예를 들어 프로젝트 파일의 유효성, dbt 버전, 필수 의존성(dbt deps 실행 시 git 등) 설치 여부를 보여줘요. 여러 축에서 데이터베이스 연결, 로컬 설정, 시스템 설정을 확인해서 dbt 명령어 실행 전 잠재적 문제를 식별하는 데 도움을 줘요.

기본적으로 dbt debug는 다음을 검증해요:

  • 데이터베이스 연결(구성된 프로필에 대해)
  • dbt 프로젝트 설정(예: dbt_project.yml 유효성)
  • 시스템 환경(OS, Python 버전, 설치된 dbt 버전)
  • 필수 의존성(dbt deps를 위한 git 등)
  • 어댑터 상세(설치된 어댑터 버전과 호환성)

Note: 문장 수준을 높이는 --debug 옵션을 통한 debug 레벨 로깅과 혼동하지 마세요.

플래그

dbt debug 플래그 대부분은 셀프호스팅 dbt CLI에 적용돼요. 일부 플래그는 dbt platform CLI에서도 동작하지만, Studio IDE에서는 --connection만 지원돼요.

  • dbt CLI: 모든 플래그를 지원해요.
  • Studio IDE: dbt debugdbt debug --connection만 지원해요.
  • dbt platform CLI: dbt debugdbt debug --connection만 지원해요.

dbt environment 명령어로도 dbt 환경과 상호작용할 수 있어요.

CLI 사용 시 dbt debug는 다음 플래그를 지원해요:

Usage: dbt debug [OPTIONS]
Show information on the current dbt environment and check dependencies, then test the database connection.
Not to be confused with the --debug option which increases verbosity.

Options:
  --cache-selected-only / --no-cache-selected-only   At start of run, populate relational cache only for schemas
                                                     containing selected nodes, or for all schemas of interest.
  -d, --debug / --no-debug                           Display debug logging during dbt execution. Useful for debugging
                                                     and making bug reports.
  --defer / --no-defer                               If set, resolve unselected nodes by deferring to the manifest
                                                     within the --state directory.
  --defer-state DIRECTORY                            Override the state directory for deferral only.
  --deprecated-favor-state TEXT                      Internal flag for deprecating old env var.
  -x, --fail-fast / --no-fail-fast                   Stop execution on first failure.
  --favor-state / --no-favor-state                   If set, defer to the argument provided to the state flag for
                                                     resolving unselected nodes, even if the node(s) exist as a database
                                                     object in the current environment.
  --indirect-selection [eager|cautious|buildable|empty]
                                                     Controls which tests run based on their relationships to selected
                                                     models in your DAG. Eager (default) is most inclusive and runs tests
                                                     that reference your selected models. Cautious is most exclusive and
                                                     only runs tests that reference selected models. Buildable is in
                                                     between. Empty runs no tests.
  --log-cache-events / --no-log-cache-events         Enable verbose logging for relational cache events to help when
                                                     debugging.
  --log-format [text|debug|json|default]             Specify the format of logging to the console and the log file.
  --log-format-file [text|debug|json|default]        Specify the format of logging to the log file by overriding the
                                                     default value and the general --log-format setting.
  --log-level [debug|info|warn|error|none]           Specify the minimum severity of events that are logged to the
                                                     console and the log file.
  --log-level-file [debug|info|warn|error|none]      Specify the minimum severity of events that are logged to the log
                                                     file by overriding the default value and the general --log-level
                                                     setting.
  --log-path PATH                                    Configure the 'log-path'. Only applies this setting for the
                                                     current run. Overrides the 'DBT_LOG_PATH' (v1.10 and earlier) or
                                                     'DBT_ENGINE_LOG_PATH' (v1.11 or later) when set.
  --partial-parse / --no-partial-parse               Allow for partial parsing by looking for and writing to a pickle
                                                     file in the target directory.
  --populate-cache / --no-populate-cache             At start of run, use `show` or `information_schema` queries to
                                                     populate a relational cache, which can speed up subsequent
                                                     materializations.
  --print / --no-print                               Output all {{ print() }} macro calls.
  --printer-width INTEGER                            Sets the width of terminal output
  --profile TEXT                                     Which existing profile to load. Overrides setting in
                                                     dbt_project.yml.
  -q, --quiet / --no-quiet                           Suppress all non-error logging to stdout. Does not affect
                                                     {{ print() }} macro calls.
  -r, --record-timing-info PATH                      When this option is passed, dbt will output low-level timing
                                                     stats to the specified file. Example: `--record-timing-info
                                                     output.profile`
  --send-anonymous-usage-stats / --no-send-anonymous-usage-stats
                                                     Send anonymous usage stats to dbt Labs.
  --state DIRECTORY                                  Unless overridden, use this state directory for both state
                                                     comparison and deferral.
  --static-parser / --no-static-parser               Use the static parser.
  -t, --target TEXT                                  Which target to load for the given profile
  --use-colors / --no-use-colors                     Specify whether log output is colorized in the console and the
                                                     log file.
  --use-colors-file / --no-use-colors-file           Specify whether log file output is colorized by overriding the
                                                     default value and the general --use-colors/--no-use-colors setting.
  -V, -v, --version                                  Show version information and exit
  --version-check / --no-version-check               If set, ensure the installed dbt version matches the
                                                     require-dbt-version specified in the dbt_project.yml file (if any).
  --warn-error                                       If dbt would normally warn, instead raise an exception. Examples
                                                     include --select that selects nothing, deprecations, configurations
                                                     with no associated models, invalid test configurations, and missing
                                                     sources/refs in tests.
  --warn-error-options WARNERROROPTIONSTYPE          If dbt would normally warn, instead raise an exception based on
                                                     include/exclude configuration. This argument should be a YAML string,
                                                     with keys 'include' or 'exclude'. eg.
                                                     '{"include": "all", "exclude": ["NoNodesForSelectionCriteria"]}'
  --write-json / --no-write-json                     Whether or not to write the manifest.json and run_results.json
                                                     files to the target directory
  --connection                                       Test the connection to the target database independent of
                                                     dependency checks. Available in Studio IDE and dbt CLI
  --config-dir                                       Print a system-specific command to access the directory that the
                                                     current dbt project is searching for a profiles.yml. Then, exit.
  --profiles-dir PATH                                Which directory to look in for the profiles.yml file. If not set,
                                                     dbt will look in the current working directory first, then HOME/.dbt/
  --project-dir PATH                                 Which directory to look in for the dbt_project.yml file.
  --vars YAML                                        Supply variables to the project. This argument overrides variables
                                                     defined in your dbt_project.yml file. This argument should be a YAML
                                                     string, eg. '{my_variable: my_value}'
  -h, --help                                         Show this message and exit.

사용 예시

데이터 플랫폼에 대한 연결만 테스트하고 다른 검사는 건너뛰기 — dbt debug가 찾는 내용:

dbt debug --connection

profiles.yml 파일의 구성된 위치를 보여주고 종료:

dbt debug --config-dir

profiles.yml 파일을 보려면 실행하세요:

open /Users/alice/.dbt

Studio IDE에서 연결 테스트:

dbt debug --connection

더 알아보기 (Learn more)