dbtf lineageコマンドが何なのか調査してみた
こんにちは。stable株式会社のmyshmehです。
先日開催のdbt meetup#15で、NTTデータグループの長塚さんがスライドの中でdbtf lineageというコマンドが実装途中としてあるのではと言及されてました。

自分はそのコマンドがdbtfにあると知らなかったので、そもそもこれは何で今どういう状況なのか調べてみました。
TL;DR
dbtf lineageコマンドはヘルプ文は存在するが実装されておらず、SDF時代の残骸として内部スタッフのデバッグ用途でのみ利用可能。一般公開されるべき性質のものではなかった。
dbtf lineageとは?
まず、dbtf --helpでは当該コマンドは表示されません。しかし、dbtf lineage --helpは次のように出力され、モデルのリネージ情報を生成すると説明されています。
Generate lineage information for models
Usage: dbt lineage [OPTIONS]
Options:
--target <TARGET>
The target to execute
--project-dir <PROJECT_DIR>
The directory to load the dbt project from [env: DBT_PROJECT_DIR=]
--profile <PROFILE>
The profile to use [env: DBT_PROFILE=]
--profiles-dir <PROFILES_DIR>
The directory to load the profiles from [env: DBT_PROFILES_DIR=]
--packages-install-path <PACKAGES_INSTALL_PATH>
The directory to install packages [env: DBT_PACKAGES_INSTALL_PATH=]
--target-path <TARGET_PATH>
The output directory for all produced assets [env: DBT_TARGET_PATH=]
--vars <VARS>
Supply var bindings in yml format e.g. '{key: value}' or as separate key: value pairs
-s, --select <SELECT>...
Select nodes to run
--exclude <EXCLUDE>...
Select nodes to exclude
--selector <SELECTOR>
The name of the yml defined selector to use
--indirect-selection <INDIRECT_SELECTION>
Choose which tests to select adjacent to resources: eager (most inclusive), cautious (most exclusive), buildable (inbetween) or empty [env: DBT_INDIRECT_SELECTION=]
-q, --quiet
Suppress all non-error logging to stdout. Does not affect {{ print() }} macro calls [env: DBT_QUIET=]
-t, --threads <THREADS>
The number of threads to use [Run with --threads 0 to use max_cpu [default: 1]]
--single-threaded
Overrides threads [env: DBT_SINGLE_THREADED=]
--write-json
Write JSON artifacts to disk [env: DBT_WRITE_JSON=]. Use --no-write-json to suppress writing JSON artifacts [env: DBT_WRITE_JSON=]
--defer
[env: DBT_DEFER=]
--state <STATE>
Unless overridden, use this state directory for both state comparison and deferral [env: DBT_STATE=]
--log-path <LOG_PATH>
Set 'log-path' for the current run, overriding 'DBT_LOG_PATH' [env: DBT_LOG_PATH=]
--log-format <LOG_FORMAT>
Set logging format; use --log-format-file to override [env: DBT_LOG_FORMAT=] [default: text] [possible values: text, json, fancy]
--log-format-file <LOG_FORMAT_FILE>
Set log file format, overriding the default and --log-format setting [env: DBT_LOG_FORMAT_FILE=] [possible values: text, json, fancy]
--log-level <LOG_LEVEL>
Set minimum severity for console/log file; use --log-level-file to set log file severity separately [env: DBT_LOG_LEVEL=]
--log-level-file <LOG_LEVEL_FILE>
Set minimum log file severity, overriding the default and --log-level setting [env: DBT_LOG_LEVEL_FILE=]
--send-anonymous-usage-stats
[env: DBT_SEND_ANONYMOUS_USAGE_STATS=]
--show [<SHOW>...]
Show produced artifacts [default: 'progress']
[possible values: progress, progressrun, progressparse, progressrender, progressanalyze, inputfiles, manifest, schedule, nodes, instructions, sourcedschemas, schema, data, stats, lineage, all, none, rawlineage, taskgraph]
--show-scans
Display scan dependencies in addition to copy and mod dependencies. Unset by default
--max-depth <MAX_DEPTH>
Limiting the depth of shown lineage tree. Default value of 0 shows full lineage [default: 0]
--use-fqtn
Show and write column lineage with fully qualified table names
-h, --help
Print help
ただし、dbtf lineageを実行するとエラーが出ます。
error: dbt1000: error: unrecognized subcommand 'Lineage'
Usage: dbt [OPTIONS] <COMMAND>
For more information, try '--help'.
つまり、lineageというコマンドはヘルプ文が存在するが、実装はない?状態になっています。
公式回答
dbt slackのdbt-fusion-engineチャンネルを眺めると、lineageコマンドとは?という質問に対して、公式が以下の通り回答していました。
This is mostly SDF ghosts :ghost: (see also lint :sweat_smile:)
The command does work for internal staff for debugging, but it shouldn't really be exposed here
つまり、lineageはSDF時代の残骸であって、内部スタッフにのみ公開されているコマンドでした。実際に、SDFにはlineageコマンドがあって、以下のようにテキストデータでカラムリネージが出力されます。
sdf lineage
Working set 4 model files, 2 .sdf files
Finished 4 models [4 reused] in 0.385 secs
Table: sdf_demo.pub.child1
sdf_demo.pub.child1.column_name_alias
│
│ copy
└──────┐
sdf_demo.pub.parent.columnA
sdf_demo.pub.child1.columnA
│
│ copy
└──────┐
sdf_demo.pub.parent.columnA
よって、lineageコマンドは実装途中ではなく、そもそも実装済みであり公開予定のない性質のものと読めました。
結論
もし本コマンドの公開予定がないならば、column-level lineageの情報は長塚さんが例に出したように色々な応用先があると思われるので、いささか残念というほかないです。。VSCode拡張でしかアクセスできないのは本当に勿体無い。。
ぜひ、将来的にはCLIから(カラム)リネージ情報を取得できるようにご検討いただきたいと切に願うばかりです。
これからもdbt Fusionの開発状況をウォッチし、色々なお役立ち情報を共有していこうと思います。
参考文献
- 該当slack thread: https://getdbt.slack.com/archives/C088YCAB6GH/p1748893600674719
Discussion