Skip to content

Give TableId a catalog component - #274

Merged
jat255 merged 3 commits into
jat255/yfan-warehouse-emittersfrom
jat255/xp65-catalog-core
Sep 6, 2026
Merged

Give TableId a catalog component#274
jat255 merged 3 commits into
jat255/yfan-warehouse-emittersfrom
jat255/xp65-catalog-core

Conversation

@jat255

@jat255 jat255 commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator

First PR of the catalog import stack (kata xp65). Stacked on #273.

Summary

A warehouse names a table catalog.schema.table, and TableId had two levels, so everything before the last dot became the schema. ANALYTICS.PUBLIC.ORDERS quoted to "ANALYTICS.PUBLIC"."ORDERS": one identifier with a dot inside it, naming a schema no warehouse has. That is a live bug for engine sources today, not only a gap ahead of catalog import, which is why it is a fix rather than a feature.

Three levels now, kept apart rather than folded into a string. parts is what quoting and probing walk, so neither has to know how many levels a backend has.

Two inputs are now refused rather than accepted. A TableId with a catalog but no schema, because there is no level between them to leave out. And a name with more than three parts, which previously became a schema containing dots.

The engine inspector joins the levels above the table into one dotted schema, which is SQLAlchemy's convention, rather than passing the schema alone and probing the wrong namespace. No dialect available to the suite has three levels, so that argument is asserted by recording it rather than by a real probe, which is the one piece of test-double here and the comment says why.


R Changes

@simonpcouch there are some R behavior changes in this PR, to address an issue with how catalogs are handled on the R side, filed as #302 and fixed here. R's string parser now reads three parts as catalog.schema.table and refuses more than three, matching the Python behavior above. The shared fixture caught R's strsplit() silently dropping a trailing empty piece, so "orders." parsed as a bare name; a trailing dot is now checked separately.

The parsing rules are user-observable in both languages, so they live in tests/shared/table-names.json with a runner in each suite, replacing the per-language copies added earlier in this stack.

@jat255
jat255 marked this pull request as draft September 4, 2026 05:49
@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
@jat255
jat255 force-pushed the jat255/xp65-catalog-core branch from 606312e to c335b87 Compare September 5, 2026 04:58
@jat255
jat255 force-pushed the jat255/xp65-catalog-core branch from c335b87 to 82a8ff9 Compare September 6, 2026 02:07
@jat255 jat255 added the r Affects the R implementation label Sep 6, 2026
@jat255
jat255 marked this pull request as ready for review September 6, 2026 05:01
@jat255
jat255 requested a review from simonpcouch September 6, 2026 05:03
@jat255 jat255 removed the needs-manual-review Agent-created work that needs a human review label Sep 6, 2026
@jat255

jat255 commented Sep 6, 2026

Copy link
Copy Markdown
Collaborator Author

Manual review completed 2026-09-05 23:04 MDT by @jat255. (Reviewed as part of the M2 stack pass; the R-side parsing bug found during review was filed as #302 and fixed here in 4e3f039.)

A warehouse names a table catalog.schema.table, and TableId had two levels,
so everything before the last dot became the schema. `ANALYTICS.PUBLIC.ORDERS`
quoted to "ANALYTICS.PUBLIC"."ORDERS": one identifier containing a dot,
naming a schema no warehouse has. That is a live bug for engine sources
today, not only a gap ahead of catalog import.

Three levels now, with the components kept apart rather than folded into one
string. `parts` is what quoting and probing walk, so neither has to know how
many levels a backend has. A catalog without a schema is refused, since
there is no level between them to leave out, and a name with more than three
parts is refused rather than guessed at.

The engine inspector joins the levels above the table into one dotted
`schema`, which is SQLAlchemy's convention, instead of passing only the
schema and silently probing the wrong namespace. No dialect available to the
suite has three levels, so that argument is asserted by recording it.

First of the catalog import stack (kata xp65).
The quoting test covered DuckDBBackend, which has its own implementation, so
the changed SQLAlchemy preparer path was untested. Confirmed to bite by
folding the outer components back into one quote_schema() call.

Found by roborev job 328.
Closes #302.

R's string parser folded everything before the last dot into the schema,
so "ANALYTICS.PUBLIC.ORDERS" quoted as "ANALYTICS.PUBLIC"."ORDERS": one
identifier with a dot inside it, naming a schema no warehouse has. The
fold predates catalog support (97db857); the Databricks/Snowflake work
added catalogs through DBI::Id and never revisited string parsing.

Three parts now split into catalog, schema, and table, and more than
three are refused, matching the Python side. strsplit() drops a trailing
empty piece, so a trailing dot is checked separately; the shared fixture
caught R accepting "orders." as a bare name.

The parsing rules are user-observable in both languages, so they move
into tests/shared/table-names.json with a runner in each suite, and the
per-language copies added earlier in this stack come out.
@jat255
jat255 force-pushed the jat255/xp65-catalog-core branch from 4e3f039 to c1b0251 Compare September 6, 2026 05:36
@github-actions

github-actions Bot commented Sep 6, 2026

Copy link
Copy Markdown

Preview deployed to Connect (dogfood.team.pct.posit.it): https://dogfood.team.pct.posit.it/connect/#/apps/d7a36cae-8f27-448b-a478-61b81fbe3942/draft/368171

Deployed from commit c1b0251.

@github-actions

github-actions Bot commented Sep 6, 2026

Copy link
Copy Markdown

Preview deployed to Connect (connect.staging.pct.posit.it): https://connect.staging.pct.posit.it/connect/#/apps/ad662e1b-5048-4acc-9ad7-f9478c92274e/draft/2641

Deployed from commit c1b0251.

@jat255
jat255 merged commit 9d68420 into main Sep 6, 2026
13 checks passed
@github-actions

github-actions Bot commented Sep 6, 2026

Copy link
Copy Markdown

Cleaned up 1 preview bundle(s) on https://dogfood.team.pct.posit.it: 368171

@github-actions

github-actions Bot commented Sep 6, 2026

Copy link
Copy Markdown

Cleaned up 1 preview bundle(s) on https://connect.staging.pct.posit.it: 2641

@jat255
jat255 deleted the jat255/xp65-catalog-core branch September 6, 2026 23:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

py Affects the Python implementation r Affects the R implementation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

R reads a three-part table name string as a dotted schema instead of catalog.schema.table

2 participants