Skip to content

feat: Replace information schema with describe calls#1415

Open
tejassp-db wants to merge 16 commits intomainfrom
replace-IS-with-describe-calls
Open

feat: Replace information schema with describe calls#1415
tejassp-db wants to merge 16 commits intomainfrom
replace-IS-with-describe-calls

Conversation

@tejassp-db
Copy link
Copy Markdown
Collaborator

@tejassp-db tejassp-db commented Apr 21, 2026

Description

Replace expensive information_schema queries with a single DESCRIBE TABLE EXTENDED ... AS JSON call for metadata fetching in _describe_relation methods. Gated behind DBRCapability.DESCRIBE_TABLE_EXTENDED_AS_JSON (DBR 17.3+), falls back to existing info_schema queries on older runtimes.

Changes:

  • IncrementalTableAPI._describe_relation: replaces 4 info_schema queries (PK, FK, non-null constraints, column masks) with AS JSON parsing
  • MaterializedViewAPI._describe_relation: replaces get_view_description (info_schema.views) with AS JSON parsing
  • ViewAPI._describe_relation: same as MV
  • New DatabricksDescribeJsonMetadata parser class with composite PK/FK support
  • New is_describe_as_json_supported() gating method (checks HMS, foreign table, capability)
  • New is_foreign_table property on DatabricksRelation
  • New describe_table_extended_as_json Jinja macro

Testing:

  • 56 unit tests: parser, processor roundtrip, diff validation, edge cases
  • Capability boundary tests (17.2 vs 17.3)
  • is_describe_as_json_supported unit tests (UC, HMS, foreign table, no capability)
  • Jinja macro SQL generation test
  • Functional tests validated on both code paths:
    • SQL warehouse (DBR 17.3+): all 14 constraint/mask tests passed via DESCRIBE AS JSON path
    • UC cluster (DBR 16.4 LTS): all 14 tests passed via information_schema fallback path

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.

PECOBLR-2546

sd-db and others added 12 commits January 28, 2026 22:27
Introduces support for Unity Catalog row filters across table,
incremental, materialized view, and streaming table materializations to
enable fine-grained row-level security

[One
Pager/PRD](https://drive.google.com/file/d/1gG1JeeEidcNGkuy9cScnbk0tWwwbLGps/view?usp=sharing)
[Internal Doc]
[Implementation
Plan](https://drive.google.com/file/d/1dBxOzqgEWa6PnBKZb_AGR-TPfV0dvFAq/view?usp=sharing)
[Internal Doc]

### Testing

- Added functional tests to verify behaviour across the possible
materialisation types [table/incremental/MV/ST] for CREATE/ALTER/DROP
behaviour across V1/V2 materialisations
- Added sufficient unit tests, to check correctness of helper
function/macros

### Checklist
- [x] Code has been tested in development
- [x] Relevant tests have been added
- [x] CHANGELOG.md has been updated with this feature
### Description

Adds initial implementation of UC metric views as a materialization

### Checklist

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

---------

Co-authored-by: Eric Jang <eric.jang@databricks.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
## Description

Users want to create Python UDFs using dbt's functions feature on
Databricks, but the current dbt-databricks adapter restricts UDF
creation to SQL only. This PR looks to add support for Python UDFs (of
the [following form/format +
more](https://learn.microsoft.com/en-us/azure/databricks/udf/unity-catalog))

```
# def + explicit call -- for more complex logic
def compute(value):
    return value * 2
return compute(value)

# Inline return -- parameters are available as local variables
return value * 2
```


## Checklist

- [x] I have run this code in development and it appears to resolve the
stated issue
- [x] This PR includes tests, or tests are not required/relevant for
this PR
- [x] I have updated the `CHANGELOG.md` and added information about my
change to the "dbt-databricks next" section.
Add alternate code path for metadata fetching in _describe_relation
methods using DESCRIBE TABLE EXTENDED AS JSON (DBR 17.3+).

Replaces 4 information_schema queries in IncrementalTableAPI and
get_view_description in MaterializedViewAPI/ViewAPI. Falls back
to legacy queries when capability is unavailable.

PECOBLR-2546
@tejassp-db tejassp-db self-assigned this Apr 21, 2026
@tejassp-db tejassp-db changed the title Replace information schema with describe calls feat: Replace information schema with describe calls Apr 21, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 21, 2026

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  dbt/adapters/databricks
  __version__.py
  dbr_capabilities.py
  impl.py 417-420, 423-424, 957-963, 974-980, 1103-1115, 1135-1139, 1158-1184, 1202-1222, 1230, 1236-1244
  relation.py 59, 143, 147, 151
  dbt/adapters/databricks/relation_configs
  column_tags.py
  incremental.py
  materialized_view.py
  metric_view.py
  row_filter.py 132, 206
  streaming_table.py
  tags.py
Project Total  

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

canbekley and others added 4 commits April 25, 2026 19:06
Resolves #1270

### Description

Provides a solution to add support for configuring key-only
`databricks_tags` for tables and columns. Utilizes existing databricks
sql patterns, which treat values of key-only patterns as empty strings
(when queried from `information_schema.tags` and also when applied via
sql: `ALTER TABLE ... SET TAGS ('key_only_tag' = '', ...)`)

### Checklist

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

---------

Signed-off-by: Can Bekleyici <can.bekleyici@deepl.com>
Co-authored-by: Shubham Dhal <shubham.dhal@databricks.com>
Wrap long docstrings and expressions to satisfy E501, and add the
missing return annotation on DatabricksRelation.is_foreign_table for
mypy.

Co-authored-by: Isaac
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.

4 participants