Skip to content

fix(r): read a Snowflake semantic view's base table names as SQL identifiers - #448

Open
jat255 wants to merge 3 commits into
jat255/441-typed-null-date-shiftfrom
jat255/446-semantic-quoted-base-tables
Open

jat255 wants to merge 3 commits into
jat255/441-typed-null-date-shiftfrom
jat255/446-semantic-quoted-base-tables

Conversation

@jat255

@jat255 jat255 commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #446

This PR fixes how R reads the table names in a Snowflake semantic view. Snowflake gives each name as it was written in SQL, so a table created as "orders" came back with its quote marks, and data_source() could not find it. R now removes the quotes from a quoted name, and changes an unquoted name to upper case, as Snowflake does.

Details (agent-written)

snowflake_semantic_dependencies() now unquotes a quoted name (a doubled quote stands for one) and folds an unquoted name to upper case, which is how Snowflake resolved it when the view was created. A database or schema that the YAML leaves out comes from the view's own id, which is already exact, so it is not folded.

Testing: the full R suite passes, with new cases for a quoted name, an unquoted one, an escaped quote, and an inherited mixed-case namespace. On live Snowflake, "live Snowflake scopes models associated with physical tables" passes against the views that #431 provisions.

Kata: whhh.

R changes

Reading a Snowflake semantic view now records its base tables under the names Snowflake resolved (catalog-snowflake.R). A view over "orders" used to depend on a table literally named with quotes, and data_source(con, tables = model$dependencies) failed with "not on the connection". It now finds orders. An unquoted lowercase name in the YAML now resolves to the upper-case table, where it used to be quoted as written.

@jat255 jat255 added bug Something isn't working r Affects the R implementation needs-manual-review Agent-created work that needs a human review labels Oct 22, 2026
@jat255
jat255 force-pushed the jat255/446-semantic-quoted-base-tables branch from dc6a57f to 421986a Compare October 23, 2026 22:23
@jat255
jat255 added this pull request to stack #454 October 23, 2026 22:25
@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

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

Deployed from commit e3e563f.

@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

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

Deployed from commit e3e563f.

@jat255
jat255 force-pushed the jat255/446-semantic-quoted-base-tables branch from 421986a to f463d1c Compare October 28, 2026 19:50
…tifiers

The view's YAML keeps a quoted name's quotes, so a base table created as "orders" was recorded as a table literally named with quotes, and scoping a source to the view's dependencies failed. Quoted names are now unquoted, with a doubled quote standing for one, and unquoted names fold to upper case.

Closes #446
A namespace the YAML leaves out comes from the view's own id, which Snowflake already reports exactly, so folding it to upper case broke a view in a quoted mixed-case database or schema.
@jat255
jat255 force-pushed the jat255/446-semantic-quoted-base-tables branch from f463d1c to b15caa1 Compare October 30, 2026 21:59
@jat255
jat255 marked this pull request as ready for review October 30, 2026 22:17
@jat255
jat255 requested a review from simonpcouch October 30, 2026 22:17
@jat255 jat255 removed the needs-manual-review Agent-created work that needs a human review label Oct 30, 2026

@simonpcouch simonpcouch left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you🏄

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working r Affects the R implementation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

R keeps the quotes in a Snowflake semantic view's quoted base table names

2 participants