Skip to content

Fixes #33709: [Ingestion] append source tags when overrideMetadata is off [1.13] - #33710

Merged
mohittilala merged 2 commits into
1.13from
fix/1.13-column-tag-append
Sep 21, 2026
Merged

mohittilala merged 2 commits into
1.13from
fix/1.13-column-tag-append

Conversation

@mohittilala

@mohittilala mohittilala commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Describe your changes:

Fixes #33709

1.13 only. On main and 2.0 database entities go through the server's bulk endpoint, where the server already merges tags additively on a PUT. That came with #28155, which is not backportable.

What's broken

With Overwrite Metadata off, re-ingestion patches from the ingestion side and only add operations survive for the fields in RESTRICT_UPDATE_LIST:

  • column tags are never appended, because _should_update_restricted_field keeps the stored list whenever both sides are non-empty. Right for description, owners and displayName, wrong for tags, which are additive.
  • entity level tags are diffed by position, so a new tag survives only when the source lists it last.

What this changes

tags are merged rather than replaced or kept when overrideMetadata is off, at the entity level and in the column arrays including nested children. Stored tags come first, so the operations stay add-only and survive the existing filter. Tags are deduplicated on (tagFQN, source), the key the server matches on.

overrideMetadata=true is unchanged: the source list still wins, per #32496. Nothing is removed in either direction, so a tag deleted at the source stays.

The only caller that passes restrict_update_fields is metadata_rest.patch_entity, so this is scoped to the connector re-ingestion path. Auto-classification writes tags through patch_column_tags, a separate path.

Verified end to end

On a 1.13 stack against a live Snowflake account, on a column that carries two tags at the source, with Overwrite Metadata off:

  • before: with the second tag absent from OpenMetadata, re-ingestion patches the table and the column still comes back with only the tag it already had.
  • after: the second tag is appended. A tag applied in the UI on the same column survives the run, and a tag removed at the source is left alone.

Type of change:

  • Bug fix

Checklist:

  • I have read the CONTRIBUTING document.
  • My PR title is Fixes <issue-number>: <short explanation>
  • I have commented on my code, particularly in hard-to-understand areas.
  • For JSON Schema changes: I updated the migration scripts or explained why it is not needed. No schema changes.
  • I have added a test that covers the exact scenario we are fixing.

TestBuildPatchTagAppend in ingestion/tests/unit/metadata/ingestion/models/test_patch_request.py covers the reported case, struct children, unstable source ordering, a tag dropped at the source, a tag added in the UI, the overrideMetadata=true contract from #32496, and that an unchanged tag list produces no patch.

RetriggerConfidence Score: 5/5

The PR appears safe to merge; the additive tag behavior and override path are consistently implemented and covered.

Summary

Updates the 1.13 ingestion patch path so source tags are appended to existing entity and column tags when metadata override is disabled.

  • Merges tags by (tagFQN, source) while retaining stored tags first, producing add-only patch operations.
  • Applies the merge to entity tags, columns, and nested child columns.
  • Preserves replacement semantics when overrideMetadata is enabled.
  • Adds unit and integration coverage for source additions, UI-curated tags, unstable ordering, nested columns, and override behavior.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Stored OpenMetadata tags] --> C{overrideMetadata}
  B[Tags discovered at source] --> C
  C -->|false| D[Merge by tagFQN and source]
  D --> E[Stored tags first]
  E --> F[Add-only JSON Patch]
  C -->|true| G[Source tags replace stored tags]
  F --> H[Entity, column, and nested child tags]
  G --> H
Loading

Reviews (2) · Last reviewed commit: "test(ingestion): match the topology patc..."

With Overwrite Metadata off, re-ingestion kept the stored tag list for any column that already carried a tag, so a tag added at the source after the first run never landed. Entity level tags went through the positional diff and survived only when the source happened to list them last.

Tags are now merged rather than replaced or kept, matching what the server does for a PUT. overrideMetadata=true still replaces them.
@mohittilala mohittilala self-assigned this Sep 21, 2026
@mohittilala
mohittilala requested a review from a team as a code owner September 21, 2026 10:48
@mohittilala
mohittilala requested review from ulixius9 and removed request for a team September 21, 2026 10:48
@github-actions

github-actions Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR checks passed

The linked issue has a description and all required Shipping project fields set. Thanks!

test_topology_patch_table_columns_with_random_order asserted that the source
tag is discarded for the table and for column5, which is exactly the behaviour
the fix removes. Both now carry the curated tag alongside the source one.

The tag assertions also indexed into tags[0]/tags[1], but the server reads tags
back with an ORDER BY tagFQN, so the index is a collation artifact once an
entity holds more than one tag. They compare sorted FQN lists now.
@gitar-bot

gitar-bot Bot commented Sep 21, 2026

Copy link
Copy Markdown
Code Review ✅ No issues found

🟡 Medium risk · Changes ingestion metadata patch semantics to merge tags across entities and nested columns

Fixes tag append behavior during re-ingestion when overrideMetadata is off. Tags are now merged additively at both entity and column levels (including nested children), with stored tags taking precedence and deduplication on (tagFQN, source). The overrideMetadata=true behavior remains unchanged, and comprehensive tests cover additions, source ordering, UI-applied tags, source-side removals, and unchanged inputs. No issues found.

Review coverage

📋 Rules No rules evaluated

🧪 Functional validation Not enabled · Set up

🤖 Auto-approval Not enabled · Set up

Options

Display: compact → Counting what did not apply, without listing it.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

@sonarqubecloud

Copy link
Copy Markdown

@mohittilala
mohittilala merged commit 0aca428 into 1.13 Sep 21, 2026
110 checks passed
@mohittilala
mohittilala deleted the fix/1.13-column-tag-append branch September 21, 2026 14:33
mohittilala added a commit that referenced this pull request Sep 21, 2026
… off [1.13] (#33710) (#33732)

* fix(ingestion): append source tags when overrideMetadata is off

With Overwrite Metadata off, re-ingestion kept the stored tag list for any column that already carried a tag, so a tag added at the source after the first run never landed. Entity level tags went through the positional diff and survived only when the source happened to list them last.

Tags are now merged rather than replaced or kept, matching what the server does for a PUT. overrideMetadata=true still replaces them.

* test(ingestion): match the topology patch test to additive tags

test_topology_patch_table_columns_with_random_order asserted that the source
tag is discarded for the table and for column5, which is exactly the behaviour
the fix removes. Both now carry the curated tag alongside the source one.

The tag assertions also indexed into tags[0]/tags[1], but the server reads tags
back with an ORDER BY tagFQN, so the index is a collation artifact once an
entity holds more than one tag. They compare sorted FQN lists now.
manerow pushed a commit that referenced this pull request Sep 22, 2026
… off [1.13] (#33710) (#33755)

* fix(ingestion): append source tags when overrideMetadata is off

With Overwrite Metadata off, re-ingestion kept the stored tag list for any column that already carried a tag, so a tag added at the source after the first run never landed. Entity level tags went through the positional diff and survived only when the source happened to list them last.

Tags are now merged rather than replaced or kept, matching what the server does for a PUT. overrideMetadata=true still replaces them.

* test(ingestion): match the topology patch test to additive tags

test_topology_patch_table_columns_with_random_order asserted that the source
tag is discarded for the table and for column5, which is exactly the behaviour
the fix removes. Both now carry the curated tag alongside the source one.

The tag assertions also indexed into tags[0]/tags[1], but the server reads tags
back with an ORDER BY tagFQN, so the index is a collation artifact once an
entity holds more than one tag. They compare sorted FQN lists now.

This branch was previously deployed

1 inactive deployment
test — 583305ba Deployed Sep 21, 2026 by mohittilala via playwright-ci-postgresql (3, 6) #91010
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Ingestion safe to test Add this label to run secure Github workflows on PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tags added at the source are not appended to columns that already have tags (1.13, overrideMetadata off)

2 participants