Skip to content

Fixes 33374: allow Table.aliases through the entity patch [1.13] - #33377

Merged
mohityadav766 merged 2 commits into
1.13from
backport/table-aliases-patch-allowlist-1.13
Sep 16, 2026
Merged

mohityadav766 merged 2 commits into
1.13from
backport/table-aliases-patch-allowlist-1.13

Conversation

@ulixius9

@ulixius9 ulixius9 commented Sep 16, 2026 •

Copy link
Copy Markdown
Member

Describe your changes:

Fixes #33374

Backport of #33375 to the 1.13 release train.

Table.aliases was silently dropped on every table that already exists in OpenMetadata, so SQL Server synonyms (includeSynonyms, shipped on 1.13.6 via #33048) only ever landed on tables created for the very first time.

When an entity already exists, TopologyRunnerMixin.yield_and_update_context emits a PatchRequest rather than a create, and sink/metadata_rest.py::patch_entity builds that patch with allowed_fields=ALLOWED_COMMON_PATCH_FIELDS. build_patch diffs both models through model_dump_json(include=allowed_fields), so a field missing from that dict can never produce an operation. aliases was missing: the connector discovered the synonyms, put them on the create request, and the patch threw them away — with no error and a 100% success run.

Deliberately not added to RESTRICT_UPDATE_LIST: aliases are source-managed and have to be replaceable and removable when a synonym is dropped at the source.

Type of change:

  • Bug fix

Differences from the main PR

The production change is identical. The new TestBuildPatchTableAliases is pytest-style on both branches (plain class, bare assert), and differs only in placement: the 1.13 file ends in module-level pytest functions, so the class goes after them. Formatted with 1.13's toolchain — pycln, isort and black==22.3.0 all report no changes.

Tests

BuildPatchTableAliasesTest drives build_patch through the exact argument set the sink uses (ALLOWED_COMMON_PATCH_FIELDS + RESTRICT_UPDATE_LIST + ARRAY_ENTITY_FIELDS) and covers first alias added, further alias appended, alias removed, and unchanged aliases. Four of the five fail without the one-line change:

$ pytest ingestion/tests/unit/metadata/ingestion/models/test_patch_request.py -q
# without the fix
4 failed, 14 passed
# with the fix
18 passed

Verified end-to-end against a 1.13.6 server with the released openmetadata-ingestion==1.13.6.0 agent and a real SQL Server 2022 with synonyms, holding overrideMetadata constant so the allow-list is the only variable:

agent overrideMetadata new synonym at source result
stock 1.13.6.0 true dbo.prod_catalog_legacy alias not written
1.13.6.0 + this change true same alias written, entity v0.1 → v0.2, resolvable via aliases.keyword search

Notes for the release

sourceHash is in the allow-list, so a run on the broken build still advances the stored hash and the connector subsequently reports "no changes detected" and skips the table. Upgrading the agent alone therefore does not backfill existing tables — one run with Override Metadata enabled is needed after this ships.

Checklist:

  • I have read the CONTRIBUTING document.
  • My PR title is of the format Fixes <issue-number>: <short description>.
  • I have commented on my code, particularly in hard-to-understand areas.
  • I have added tests that prove my fix is effective or that my feature works.
Greptile Summary

This PR allows source-managed table aliases, including SQL Server synonyms, to pass through the existing-entity patch path.

  • Adds aliases to the common patch-field allow-list so aliases can be added, replaced, and removed.
  • Adds pytest-style coverage for initial aliases, additions, removals, and unchanged values.
  • The earlier pytest-style violation has been fully fixed.
  • The earlier alias-deletion finding remains outstanding: a temporary synonym-discovery failure can still produce aliases=None and remove previously stored aliases.
Confidence Score: 4/5

The PR does not yet appear safe to merge because a temporary MSSQL synonym-discovery failure can remove previously stored aliases.

The previous blocking finding remains outstanding: allowing aliases=None through the patch path emits removal of /aliases, so transient synonym-discovery or permission failures can erase the last successfully stored alias metadata. The earlier pytest-style finding was manually resolved and the current tests now use a plain class with bare assertions.

Files Needing Attention: ingestion/src/metadata/ingestion/models/patch_request.py

Important Files Changed
Filename Overview
ingestion/src/metadata/ingestion/models/patch_request.py Adds table aliases to the patch allow-list, but the previously reported temporary-discovery-failure deletion behavior remains unresolved.
ingestion/tests/unit/metadata/ingestion/models/test_patch_request.py Adds plain pytest coverage for alias patch creation, extension, removal, and no-op behavior.

Reviews (3): Last reviewed commit: "Merge branch '1.13' into backport/table-..." | Re-trigger Greptile

@ulixius9
ulixius9 requested a review from a team as a code owner September 16, 2026 05:48
@ulixius9
ulixius9 requested review from Khairajani and removed request for a team September 16, 2026 05:48
@github-actions

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

  • No GitHub issue is linked. Link an issue in the Development section of the PR (or add Fixes #12345 to the description). For a same-org cross-repo issue, add Fixes open-metadata/<repo>#123 to the description.

The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically.

Maintainers can bypass this check by adding the skip-pr-checks label.

@github-actions github-actions Bot added Ingestion safe to test Add this label to run secure Github workflows on PRs labels Sep 16, 2026
# Source-managed: the connector recomputes it every run, so the patch has to be
# able to add, replace and remove it. Omitting it here silently drops synonyms
# on every table that already exists in OpenMetadata.
"aliases": True,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Discovery failure deletes aliases

When MSSQL synonym discovery fails temporarily, ingestion continues with an empty synonym map and produces aliases=None. Allowing this field through the patch turns that state into removal of /aliases, so a temporary source or permission failure silently deletes previously stored synonym metadata instead of preserving the last successful result.

Aliases are recomputed from the source on every run, but every table that
already exists in OpenMetadata is updated through a PatchRequest, and
build_patch diffs both models through `include=allowed_fields`. With
`aliases` missing from the allow-list the field could never produce an
operation, so SQL Server synonyms only ever landed on tables created for
the first time - silently, with no error and a 100% success run.

(cherry picked from commit 7759601)
@gitar-bot

gitar-bot Bot commented Sep 16, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 1 closed / 1 findings

Adds Table.aliases to the entity patch allow-list so existing tables can receive aliases discovered from SQL Server synonyms. The new test class was updated to pytest style to match the repository's requirements. No issues remain.

✅ 1 closed
✅ Quality: New test class uses unittest.TestCase instead of pytest style

📄 ingestion/tests/unit/metadata/ingestion/models/test_patch_request.py:450-464
Per the project's Python test requirements, tests should use plain pytest functions with assert statements rather than classes inheriting from TestCase and self.assertEqual/self.assertIn. The new BuildPatchTableAliasesTest inherits TestCase and uses self.assertEqual/self.assertIn, whereas this same file already has module-level pytest functions (e.g. test_build_patch_preserves_nested_column_metadata). Convert the class to standalone test_* functions (with a helper factory) using plain assert to match the guidance and the newer style in this file.

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

@mohityadav766
mohityadav766 merged commit c549c20 into 1.13 Sep 16, 2026
101 of 109 checks passed
@mohityadav766
mohityadav766 deleted the backport/table-aliases-patch-allowlist-1.13 branch September 16, 2026 09:31
mohityadav766 pushed a commit that referenced this pull request Sep 16, 2026
…stion 1.13.6.1 (#33400)

* Fixes 33374: allow Table.aliases through the entity patch (#33377)

Aliases are recomputed from the source on every run, but every table that
already exists in OpenMetadata is updated through a PatchRequest, and
build_patch diffs both models through `include=allowed_fields`. With
`aliases` missing from the allow-list the field could never produce an
operation, so SQL Server synonyms only ever landed on tables created for
the first time - silently, with no error and a 100% success run.

(cherry picked from commit 7759601)
(cherry picked from commit c549c20)

* bump ingestion 1.13.6.1

This branch was previously deployed

1 inactive deployment
test — 31ecb855 Deployed Sep 16, 2026 by ulixius9 via playwright-ci-postgresql (6, 6) #87273
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.

4 participants