Repository navigation
Fixes 36357: Hex data models and column-level lineage from SQL cells (2.0) - #36388
Conversation
…L cells (2.0) Backport of #36371 to 2.0, squashed from 33b47d3, 16ad476, 22d96d4, 6af0b43, 791ff4a, c42a857, cacf30b, c5d461c, 61debe6, 05f7d5c and d996669. Adapted to 2.0: - es_search_from_fqn has no raise_on_error here and returns None for a failed search, so the Hex source runs the FQN search itself and treats a search that didn't answer as an error, not as "no such table". - The project's tag handling (tag_utils) is kept as it is on 2.0. - The decision record is not added: 2.0 has no docs/decisions. The code cites ADR:2026-10-27-hex-project-is-one-data-model-with-a-column-group-per-cell-id on main.
❌ 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 |
- Data connections the token can't read raise HexAccessDeniedError and are asked for once per run. Without them an existing data model is left as it is instead of being rebuilt without dialects and connection defaults; only a project without one gets one. - A cell whose SQL fails to parse keeps its column group from the existing data model, with what users curated on it. - A column name is parsed out of the lineage leaf rather than split on dots, so a quoted "customer.id" is one name. - A column passed straight through keeps its table column's array element type, display type and nested fields. (cherry picked from commit a6b8920)
…odel The 2.0 FQN search reads each table it finds; an error there now counts as a failed search, so the project's existing data model is kept rather than rebuilt without that cell.
| if not self.source_config.includeDataModels or self._data_model_exists(project): | ||
| return None | ||
| data_connections = {} |
There was a problem hiding this comment.
With includeDataModels=false, a 403 or 404 from /data-connections now stops all SQL-cell lineage. Previously, denied access returned {}, so SQL that names the schema could still produce table-to-dashboard links. If no warehouse-history fallback is configured, those dashboards now get no lineage.
Keep the saved-model protection separate from table-only lineage so disabling data models does not disable this path.
Knowledge Base Used: Ingestion connectors
| except Exception as exc: | ||
| # Without the earlier data model, the groups of the cells that failed would be lost | ||
| logger.debug(traceback.format_exc()) | ||
| logger.warning("Could not read the data model of Hex project %s: %s", dashboard_details.id, exc) | ||
| self.datamodel_source_state.add(self._build_fqn(DashboardDataModel, dashboard_details)) | ||
| return |
There was a problem hiding this comment.
If a cell fails to parse and reading the saved model's columns then fails, this catch marks the model as seen but does not preserve its dashboard link. The cached cell list is still non-None, so _kept_data_model_fqn refuses to keep the link. No model was emitted into the stage context, so yield_dashboard sends dataModels=[] and the dashboard patch removes the existing link.
Record this skipped update as a keep condition too.
Knowledge Base Used: Ingestion connectors
# Conflicts: # ingestion/src/metadata/ingestion/source/dashboard/hex/client.py
…ugh columns - A data model kept because its existing groups couldn't be read stays linked to the dashboard: the data model stage records what it kept and the dashboard stage links it, instead of only when the cells couldn't be read. - A passed-through struct's fields copy only the table column's type, not its description, tags, constraint or profile. (cherry picked from commit c02d176)
…odel in the generated types Matches the resolution on main (#36371) of the data model sourceUrl against the workspace-scoped Hex URLs, which return None when the workspace id can't be read. The generated TypeScript enum value is the one #36371 generated on main; the type-generation workflow fails on 2.0 so it never added it here.
A cell whose SQL fails keeps its existing group, but the cells reading its result lost theirs: dataframe SQL over it was dropped and a warehouse cell searched its name as a table, coming back with UNKNOWN columns. A cell reading a failed cell now fails too, down the chain, so each keeps its group. (cherry picked from commit ea7e122)
Code Review ✅ Approved 1 closed / 1 findings🟡 Medium risk · Adding Hex project data models and SQL-derived column lineage could misattribute warehouse columns or omit lineage when cell or table resolution is wrong. Adds Hex data models with column-level lineage from project SQL cells, one ✅ 1 closed✅ Edge Case: Cells chained on a broken cell still lose their data model group
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 #36357
Backport of #36371 to
2.0: the Hex connector ingests oneHexDataModelper project, with a column group per SQL cell and column-level lineage from the warehouse tables through chained cells to the dashboard. The design, safety rules and review history are in #36371.The commits of #36371 conflicted on
2.0, so this is a squashed port, followed by #36371's last commit (c02d176, cherry-picked with-x).2.0is merged in. Its Hex source-URL fix (#36420) conflicted inhex/client.py, which is resolved the same way as onmain. Also carries #36541 (cherry-picked with-x), the fix for Gitar's finding here: cells reading a broken cell keep their data model groups. It was built by three-way merging the PR's changes onto 2.0's Hex files, with these adaptations:es_search_from_fqnon 2.0 has noraise_on_errorand returnsNonefor a failed search, the same as for no match. The Hex source runs the FQN search itself, so a search that didn't answer keeps the existing data model rather than reading as "no such table".tag_utils) is kept as it is on 2.0.build_es_fqn_search_stringis typeddatabase_name: stron 2.0, though it handlesNone; this needed one scopedpyright: ignore.HexDataModelTypeScript enum value is Fixes 36357: Hex data models and column-level lineage from project SQL cells #36371's own generated change frommain.docs/decisions/, so the recordmainhas (with Fixes 36357: Hex cells reading a broken cell keep their data model groups #36541's v2 amendment) is included and the code'sADR:citation resolves.Type of change:
Tests:
Unit tests
PYTHONPATH=src python -m pytest tests/unit/topology/dashboard/test_hex*.pyon this branch → 147 passed. The test fake now answers the raw FQN search, matching the 2.0 code path.ruff check/ruff format --checkandbasedpyrightonhex/(0 errors).Backend integration tests
HexDataModelenum value. Its impacted Java unit tests and ITs passed on Fixes 36357: Hex data models and column-level lineage from project SQL cells #36371 (678 unit, 1,884 IT, 0 failed); they were not re-run on this branch.Manual testing performed
main, with all 74 column links. A run against a server was not possible here: the local server is built frommain, and 2.0's client models reject its newer fields.UI screen recording:
Not applicable: ingestion connector change with no UI code.
Checklist:
Fixes <issue-number>: <short explanation>Fixes #<issue-number>above.Fix the two link-preservation gaps before merging.
Findings
Summary
Adds one
HexDataModelper Hex project, with SQL-cell column groups and warehouse-to-column lineage through chained cells.Diagram
%%{init: {'theme': 'neutral'}}%% flowchart LR Hex[Hex project export] --> Cells[SQL cells] Connections[Hex connections] --> Cells Cells --> Resolve[Resolve warehouse tables] Resolve --> Model[Project data model] Model --> Groups[Column group per cell] Resolve --> Links[Table and column lineage] Links --> Model Model --> Dashboard[Hex dashboard] History[Optional warehouse query history] --> DashboardReviews (2) · Last reviewed commit: "Hex (2.0): a failed read of a table the ..." · Reviewed by Greptile