Skip to content

Bind definitions to the names the warehouse reported - #283

Draft
jat255 wants to merge 1 commit into
jat255/xp65-source-wiringfrom
jat255/xp65-definition-binding
Draft

Bind definitions to the names the warehouse reported#283
jat255 wants to merge 1 commit into
jat255/xp65-source-wiringfrom
jat255/xp65-definition-binding

Conversation

@jat255

@jat255 jat255 commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator

Seventh of the catalog import stack (kata xp65), and the last of it. Stacked on #282. Python only.

A definition's expression names the columns the author wrote. A catalog import re-keys the dictionary to what the warehouse reported, which on Snowflake means upper case, so the expression has to be rewritten before it is lowered or the SQL would name columns the warehouse does not have. This is the catalog column binding that f6hz deferred to xp65.

Column paths in the IR and in a COLUMNS(...) selection take the discovered spelling. A reference to a sibling definition is a name in the dictionary rather than a column in the warehouse, so it is left for composition to inline. An authored column the relation does not have is refused rather than emitted, and so is an authored table with definitions that matched no selected relation, since dropping it would leave the agent told about a governed definition that is not there.

DefinitionExport.columns, the list of columns a definition reads, keeps the authored spelling. It describes the dictionary the author wrote, and the R implementation leaves it the same way.

This replaces the temporary refusal the previous PR shipped.

Verification

733 Python tests, ruff and pyrefly clean.

@jat255 jat255 added this to the py-M2: data layer milestone Sep 4, 2026
@jat255 jat255 added needs-manual-review Agent-created work that needs a human review py Affects the Python implementation labels Sep 4, 2026
A definition's expression names the columns the author wrote, and a
catalog import re-keys the dictionary to what the warehouse reported, so
the expression is rewritten before it is lowered: column paths in the IR
and in a COLUMNS(...) selection take the discovered spelling, references
to sibling definitions are left for composition, and an authored column
the relation does not have is refused rather than emitted.

An authored table with definitions that matched no selected relation is
refused too, since dropping it would leave the agent told about a
governed definition that is not there.
@jat255
jat255 force-pushed the jat255/xp65-definition-binding branch from 4623174 to 801b1c7 Compare September 5, 2026 04:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-manual-review Agent-created work that needs a human review py Affects the Python implementation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant