Skip to content

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

Description

@jat255

Bug

In R, data_source(con, tables = "ANALYTICS.PUBLIC.ORDERS") folds everything before the last dot into the schema: DBI::Id(schema = "ANALYTICS.PUBLIC", table = "ORDERS"). Quoted, that is "ANALYTICS.PUBLIC"."ORDERS" — one identifier with a dot inside it, naming a schema no warehouse has. The zero-row probe then fails and data_source() errors with a "table does not exist" for a table that does.

id <- DBI::Id(schema = "ANALYTICS.PUBLIC", table = "ORDERS")
DBI::dbQuoteIdentifier(DBI::ANSI(), id)
#> <SQL> "ANALYTICS.PUBLIC"."ORDERS"

The fold dates to 97db857 ("support schema-qualified connection tables", closes #15), written before the package had any catalog support. Catalogs arrived later via DBI::Id(catalog = ...) objects (the Snowflake/Databricks work), and the string parser was never revisited.

R also accepts "a.b.c.d", folding it into a doubly-dotted schema.

Expected

Match the behavior #274 gives the Python side:

  • "catalog.schema.table"DBI::Id(catalog = ..., schema = ..., table = ...)
  • More than three parts → an error naming the input and pointing at DBI::Id for literal names containing dots
  • One and two parts behave as today

The workaround meanwhile is an explicit DBI::Id(catalog = "ANALYTICS", schema = "PUBLIC", table = "ORDERS").

Shared contract

Table-name parsing is user-observable behavior both packages expose through tables, so the parsing rules belong in tests/shared/ as an executable fixture read by both suites. The fixture cannot land until R is fixed, because R currently fails the three-part case. Being fixed in #274.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingrAffects the R implementation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions