dbt-labs / dbt-labs/dbt

fix(databricks): emit only changed keys in relation-tag SET TAGS diffs

Open
#16,248 0 comments 0 reactions 0 assignees View on GitHub
adapter:databricks area:adapters engine:v2
Dominant language
Rust
Stars
13.8k
Forks
2.6k
Avg merge
21h 31m
Merged PRs (30d)
56

Description

### Description

Port of [databricks/dbt-databricks#1667](https://github.com/databricks/dbt-databricks/pull/1667).

Fusion's Databricks relation-tag alter diff (`set_only_diff`) is already set-only (no UNSET of remote-only keys), but when any desired key differs it clones the **entire** desired map into `ALTER … SET TAGS`.

dbt-databricks `TagsConfig.get_diff` now emits **only new or updated keys**. Unchanged desired keys are omitted. Remote-only tags stay unset.

Unity Catalog `SET TAGS` upserts listed keys, so server state still converges; the smaller payload is the v1 contract for alter/changeset paths.

### Concrete mismatch

Remote: `{stable=1, moved=old, remote_only=x}`
Desired: `{stable=1, moved=new}`

| | dbt-databricks (#1667) | Fusion today |
|---|---|---|
| Diff | `{moved=new}` | `{stable=1, moved=new}` |

### Expected behavior

Match dbt-databricks `TagsConfig.get_diff`:

1. Set-only: never UNSET remote-only keys.
2. Include a desired key only when it is missing remotely or its value differs.
3. Empty result → no changeset.

### Out of scope

- Column-tag diffs ([#16246](https://github.com/dbt-labs/dbt-core/issues/16246))
- Re-enabling `UNSET TAGS`
- Sharing this diff with BigQuery tags/labels (those use `diff::desired_state`, not this helper)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.