Repository navigation
Fixes 32508: [2.0] Backport profiler ORM column name fix (#32805) - #37295
Conversation
Backport open-metadata#32805 (f02e818) to 2.0. Keep the 2.0 build_orm_col signature and existing column-key behavior while preserving excluded column names and resolving attribute-name collisions. Fixes open-metadata#32508.
❌ PR checklist incompleteThis PR cannot be merged until the following are addressed on its linked issue:
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 |
|
|
This also breaks the data-quality test suite runner on 2.0.6, not only the profiler. Every test on a table whose first column starts with Reproduced with |
Code Review ✅ Approved 1 closed / 1 findings🟡 Medium risk · Remapping reserved ORM attributes and reporting source column names changes profiler and data-quality behavior; incorrect mapping could misreport columns or validation results. Backports the profiler ORM fix so columns starting with ✅ 1 closed✅ Bug: Remapped attr names leak into columnNames metric and column-name DQ tests
VerificationRules No rules evaluated Functional validation Not enabledAuto-approval Not enabledFor more verification details, comment OptionsDisplay: compact → Showing compact verification results. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |



Describe your changes:
Fixes #32508
Backports #32805 (merged commit f02e818119fd49252c27afe1b324044c64857cf4) to
2.0.The profiler now maps columns beginning with
__or_sa_through safe, unique Python attribute names. This preserves the first column's synthetic primary key and prevents these columns from being silently omitted from profiling. The source column names and existing SQLAlchemy column keys remain unchanged.The backport resolves conflicts in
converter/base.pyby retaining 2.0'sOptionalannotations andbuild_orm_col(idx, col, table.serviceType)call. It does not bring in main's separatebuild_orm_col_keyshelper or change 2.0's lowercase column-key behavior. Both upstream regression tests are preserved unchanged.Type of change:
High-level design:
Not applicable — a two-file backport of an existing bug fix. No schema, API, migration, configuration, or UI changes.
Tests:
Use cases covered
__hevo_idfirst column remains mapped and retains the synthetic primary key._sa_specialcolumn remains present in the mapped table.metadata, and MONEY/BIT conversion tests still pass.__hevo_id/om_col___hevo_idandmetadata/metadata_.Unit tests
ingestion/tests/unit/observability/profiler/test_converter.py.scripts/datamodel_generation.pyandmake py_antlr.test_dunder_prefixed_columns_are_mappedfails on the unpatched 2.0 converter withcould not assemble any primary key columns(1 failed, 10 deselected)._safe_orm_attrhelper coverage: 100% lines (8/8) and branches (6/6). The focused run reports 43.7% line coverage for the entire converter module; full-module 90% coverage was not established.pytest-rerunfailuresinitialization because the sandbox disallows its localhost socket. Disabling that retry plugin allowed normal test execution; no test was skipped.git diff upstream/2.0...HEAD --check: passed.Backend integration tests
Not applicable — no Java or backend API changes.
Ingestion integration tests
6 real SQLite insert/select scenarios passed, using fresh in-memory databases and the backported converter. No SQLAlchemy internals were mocked.
The existing server-backed
ingestion/tests/integration/orm_profiler/test_converter.pyand broader profiler suites remain pending. No OpenMetadata server was available atlocalhost:8585(the version endpoint connection failed); they were not run. This PR records focused verification, not full merge-readiness coverage.Playwright (UI) tests
Not applicable — no UI changes.
Manual testing performed
Ran a Python smoke script against the worktree:
[__hevo_id, normal_col, _sa_special]and[normal_col, __hevo_id, _sa_special].[__hevo_id, om_col___hevo_id]and its reverse, then[metadata, metadata_]and its reverse.MetaData; assert all original names and keys are present and the first column remains the sole primary key.UI screen recording / screenshots:
Not applicable — no UI changes.
Checklist:
Fixes <issue-number>: <short explanation>.Fixes #32508.fb1d989ce6c7ea2e1472fa8b6be6f8cde40e81a5againstREVIEW.md; no unanswered important findings.Summary by Gitar
col.nameinstead of ORM keysColumnNamesmetric and table metric computers now report source names viacol.nametest_column_names.pycovering metrics and validators with dunder, reserved, and mixed-case namesThis will update automatically on new commits.
Review follow-up: source column names
Addresses the column-name consumer review comment in commit
51756fa36b72b39ff7b71a9d8390de5b5a50e38a. The matchingmainfix is #37326.Profiling and the two table column-name validators now use
Column.namerather than mapped attribute keys. Includes the common/catalog, TimescaleDB, Informix and stats-based paths. The converter regression now asserts the reported metric, and a newtest_column_names.pyexercises remapped/reserved names, mixed-case source names, collisions, ordered/unordered sets, missing names and empty-column errors.Focused verification on this follow-up:
tests/unit/observability/profiler/test_column_names.py,test_converter.pyandtest_table_metric_computer.py.tests/unit/observability/data_quality/test_validations_databases.py -k 'column_name_to_exist or column_to_match_set'.ingestion/withPYTHONPATH="$PWD/src" ../env/bin/python -m pytest -p no:rerunfailures -c pyproject.toml ... -q --tb=short.column_names.py12.2%,table_metric_computer.py33.6% in this focused run. All added statements measured by coverage executed; full-module 90% remains pending.git diff --check: passed.REVIEW.md: no blocking findings.localhost:8585.