Read a Snowflake catalog - #277
Draft
jat255 wants to merge 2 commits into
Draft
Conversation
jat255
marked this pull request as draft
September 4, 2026 05:56
Third of the catalog import stack (kata xp65). Ports the catalog-import half of catalog-snowflake.R: the current namespace, SHOW OBJECTS listing and exact lookup, DESC TABLE column description, and the identifier quoting each needs. The queries are kept apart from the interpretation of their rows, following the R structure, which is what makes this testable without a warehouse: the row readers are pure and run against real SHOW OBJECTS and DESC TABLE shapes. The query builders are checked by recording the SQL they send, which is the one test double here and stands in for a network rather than for Snowflake's semantics. SHOW caps its output and a full page cannot be told apart from a page that happened to fill, so a full page is refused rather than silently truncated. SHOW OBJECTS LIKE ignores case, so its reply is filtered by exact name: asking for ORDERS and getting `orders` means a differently-cased table exists, not the one that was named. The semantic-view half of the R file is not ported and is now kata gcgj. It is a feature rather than part of catalog import, and pkg-py has no surface for it at all: R threads semantic models through ten files including commons.R, context-layer.R and pool.R, so a reader alone would produce records nothing consumes. The name filter was found to be uncovered by perturbing it and watching nothing fail; the empty-reply test could not reach it. A near-match case covers it now.
SHOW OBJECTS LIKE is capped like any other SHOW, and a full page may have dropped the match, which reported an existing table as absent. A deliberate divergence from R, which checks only when listing a namespace. The case needs a schema holding a page-full of case-variant names so it is vanishingly rare, but when it happens Python now fails loudly instead of answering wrongly, and the reason is recorded next to the check and in the test. Found by roborev job 333.
jat255
force-pushed
the
jat255/xp65-snowflake-reader
branch
from
September 5, 2026 04:58
58b3ef1 to
66796a2
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.
Third of the catalog import stack (kata xp65). Stacked on #275. Ports the catalog-import half of
catalog-snowflake.R: the current namespace,SHOW OBJECTSlisting and exact lookup,DESC TABLEcolumn description, and the identifier quoting each needs.The queries are kept apart from the interpretation of their rows, following the R structure. That is what makes this testable without a warehouse: the row readers are pure and run against real
SHOW OBJECTSandDESC TABLEshapes, and the query builders are checked by recording the SQL they send. That recorder is the one test double here, and it stands in for a network rather than for Snowflake's semantics.Two behaviours worth naming.
SHOWcaps its output and a full page cannot be told apart from a page that happened to fill, so a full page is refused rather than silently truncated. AndSHOW OBJECTS LIKEignores case, so its reply is filtered by exact name: asking forORDERSand getting backordersmeans a differently-cased table exists, not the one that was named.Deliberately out of scope: semantic views
About half of
catalog-snowflake.Ris Snowflake semantic views, and none of it is here. It is a feature rather than a part of catalog import, andpkg-pyhas no surface for it:grep -rl semantic_model pkg-py/srcreturns nothing, while R threads semantic models through ten files includingcommons.R,context-layer.Randpool.R. A reader alone would produce records nothing consumes. Tracked as kata gcgj, which also flags the question of how it relates to commons' own semantic layer.One deliberate divergence from R
exact_relation()checks for a capped reply; R checks only when listing a namespace. Without it a capped reply reports an existing table as absent, which is a wrong answer rather than a loud one. The case needs a schema holding a page-full of case-variant names, so it is vanishingly rare, and the reasoning is recorded next to the check.Verification
653 tests, ruff and pyrefly clean. Worth knowing: the exact-name filter was originally uncovered. Perturbing it failed nothing, because the only test reaching that path supplied an empty reply. A near-match case covers it now, and that is why the perturbation pass is worth doing rather than trusting a green suite.