Bind definitions to the names the warehouse reported - #283
Draft
jat255 wants to merge 1 commit into
Draft
Conversation
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
force-pushed
the
jat255/xp65-definition-binding
branch
from
September 5, 2026 04:58
4623174 to
801b1c7
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.