Skip to content

fix: skip DESCRIBE TABLE EXTENDED AS JSON for foreign/federated tables#1472

Merged
sd-db merged 7 commits into
databricks:mainfrom
willweld:fix/skip-describe-json-for-foreign-tables
Jun 2, 2026
Merged

fix: skip DESCRIBE TABLE EXTENDED AS JSON for foreign/federated tables#1472
sd-db merged 7 commits into
databricks:mainfrom
willweld:fix/skip-describe-json-for-foreign-tables

Conversation

@willweld

Copy link
Copy Markdown
Contributor

Resolves #

Description

For federated/foreign tables, DESCRIBE TABLE EXTENDED ... AS JSON is not supported. The adapter was attempting it on every get_columns_in_relation call before catching the error and falling back to plain DESCRIBE TABLE, causing repeated failures and extra latency on affected code paths (e.g. incremental merge strategy, table create).

The fix adds relation.is_foreign_table to the use_legacy_logic guard in get_columns_in_relation, so the JSON path is never attempted for foreign tables. This is consistent with the existing check in is_describe_as_json_supported() which already excludes foreign tables — the column-fetch path was simply missing the same guard.

No new infrastructure is needed: DatabricksRelationType.Foreign and relation.is_foreign_table already exist.

Checklist

  • I have run this code in development and it appears to resolve the stated issue
  • This PR includes tests, or tests are not required/relevant for this PR
  • I have updated the CHANGELOG.md and added information about my change to the "dbt-databricks next" section.

Note: I do not have access to a Databricks workspace with federated tables to run functional tests against. Per CONTRIBUTING.md, I'm flagging this for a maintainer /integration-test run.

Foreign/federated tables do not support the AS JSON form, causing the
adapter to attempt it (and fail) before falling back to plain DESCRIBE
TABLE on every code path that calls get_columns_in_relation. Add
relation.is_foreign_table to the use_legacy_logic guard, consistent with
the existing check in is_describe_as_json_supported().

Signed-off-by: willweld <williamweld@outlook.com>
willweld and others added 5 commits May 20, 2026 11:25
Signed-off-by: willweld <williamweld@outlook.com>
Add a UC functional test that verifies get_columns_in_relation skips the
DESCRIBE AS JSON path for Foreign relations, plus a unit test assertion
that the legacy macro is invoked exactly once.

@sd-db sd-db left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good, I am looking to add a functional test + run all functional tests and will merge. Thanks for the PR !

@sd-db

sd-db commented Jun 1, 2026

Copy link
Copy Markdown
Collaborator

/integration-test

@github-actions

github-actions Bot commented Jun 1, 2026

Copy link
Copy Markdown

Integration tests dispatched for PR #1472 by @sd-db. Track progress in the Actions tab.

@github-actions

github-actions Bot commented Jun 1, 2026

Copy link
Copy Markdown

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  dbt/adapters/databricks
  impl.py
Project Total  

This report was generated by python-coverage-comment-action

@github-actions

github-actions Bot commented Jun 1, 2026

Copy link
Copy Markdown

Integration results for PR #1472 — UC cluster ✅ success · SQL warehouse ✅ success · All-purpose cluster ✅ success · Shard coverage ✅ success

Run details.

@sd-db sd-db merged commit 19d86a4 into databricks:main Jun 2, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants