persist_docs.columns triggers a full-plan probe query on views even when the model has no column docs

オープン 初心者向け
#1,680 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 6 日以内に返信

@DelorneN007 がすでに取り組んでいます。

2026年9月14日 から。

  • #1681 @DelorneN007 による — オープン

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
85/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
sql
領域
databases

調査の方向性

dbt/include/databricks/macros/relations/view/create.sql から始め、そのカラムドキュメント用 guard を macros/adapters/persist_docs.sql と比較します。schema.yml にカラムエントリがなく、persist_column_docs が有効になっているビュー model で再現します。model のカラムがない場合に full-plan probe query が実行されず、ドキュメント化されたカラムは引き続き persist されれば完了です。

索引モデルが issue の本文から書いたものです。

説明

bug

Describe the bug

With persist_docs: {columns: true}, databricks__create_view_as always calls get_columns_in_query(sql) before creating a view, which executes select * from (<full model sql>) as __dbt_sbq where false limit 0 against the warehouse. It does this even when the model has no columns: entries in any schema YAML, in which case the resulting column list contains no comment clauses and is semantically identical to emitting no column list at all.

On a wide view the probe hangs for a long time. where false is only folded after full analysis, so Spark still plans the whole query and does Delta metadata/file listing on every source.

Expected behavior

No probe query when the model has no column descriptions. dbt's own macros/adapters/persist_docs.sql already uses this guard:

{% if for_columns and config.persist_column_docs() and model.columns %}

The Databricks view path omits the and model.columns short-circuit.

Suggested fix

In dbt/include/databricks/macros/relations/view/create.sql:

{%- if config.persist_column_docs() and model.columns -%}

Steps to reproduce

  1. Set persist_docs: {relation: true, columns: true} in dbt_project.yml
  2. Create a materialized='view' model with no corresponding schema.yml entry
  3. Run dbt run -s that_model and observe the where false limit 0 query in the Databricks query history

Notes

  • Workaround: persist_docs={'relation': True, 'columns': False} per model.

System information

  • dbt-databricks: 1.11.6
  • dbt-core: 1.11.6
  • databricks-sql-connector: 4.1.3
主要言語
Python
スター
391
フォーク
231
平均マージ
9日 7時間
マージ済み PR(30日)
29

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

databricks/dbt-databricks のほかの issue

databricks/dbt-databricks の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。