Skip to content

Run the warehouse implementations against real Snowflake and Databricks #303

Description

@jat255

Everything commons knows about Snowflake and Databricks has been verified against a fake. Nothing in pkg-py has ever run a statement against a real warehouse, and the R live tests have no way to run anywhere except one person's laptop. The catalog readers, the access and session checks, and the warehouse SQL emitters are all specified against what we believe those systems return.

What exists today

pkg-r/tests/testthat/test-live-warehouses.R (744 lines) plus helper-live-warehouses.R connect through ODBC (odbc::snowflake(), a DSN named Databricks) and skip unless R options name real objects: a test table, a denied table, an alternate Snowflake role, semantic views, parameterized models. pkg-r/tests/testthat/README.md documents the options. Nothing provisions the objects those options point at, no CI job runs any of it, and pkg-py has no equivalent at all: every warehouse test there drives a fake backend that replays canned rows.

The open question

Where does the warehouse come from? This is the decision the rest depends on, so it should be made first. Options worth pricing:

  • a shared Posit-owned Snowflake account and Databricks workspace, with credentials in GitHub secrets;
  • per-developer trial accounts plus a provisioning script;
  • Databricks free edition or a Snowflake trial, created and torn down in CI;
  • accepting that this stays manual, and lives in a documented pre-release checklist rather than in CI.

Then the mechanics

  • Provisioning as code. The fixtures are not just a table. The access tests need an object the test principal genuinely cannot read, and the session test needs a second usable role. A SQL script (or Terraform) that creates the schema, tables, views, roles, and grants would bring any account to a known state and stop the test options being hand-typed identifiers.
  • A Python harness of the same shape. Python connects through SQLAlchemy rather than ODBC/DBI, so this needs snowflake-sqlalchemy and databricks-sqlalchemy as optional dev dependencies, an environment-variable or config equivalent of the R options, and a clean skip when they are unset.
  • Credential handling. What reaches CI, what stays local, and what a contributor without warehouse access sees. Today they get a clean skip, which should stay true.
  • Scope of what gets asserted. Prefer what a fake cannot tell us over restating unit tests: identifier case folding per backend, the real row shapes of SHOW OBJECTS, DESC TABLE, system.information_schema and DESCRIBE TABLE, the SQLSTATE and message a genuine permission refusal carries, the session identity queries, and whether the Snowflake and Databricks SQL the definition emitters produce actually executes.

Why it matters

tests/shared/catalog-access-errors.json decides whether a driver failure is an authorization refusal, a transient fault, or neither, and commons caches the refusal or retries based on that answer. Its cases were written from documentation rather than from a captured failure. tests/shared/definition-warehouse-sql.json pins SQL that no warehouse has ever parsed, and it is hand-maintained precisely because there is no upstream authority to check it against. A live run is what turns both from plausible into verified. The same applies to the native semantic-model probes for Snowflake semantic views and Databricks metric views, which cannot be written honestly without one.

Not urgent for the conference demo, which runs on DuckDB, and not a blocker for the data layer milestone. It is what stands between "the warehouse support is implemented" and "the warehouse support is known to work".

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

    pyAffects the Python implementationrAffects the R implementationtestsRelated to testing or the test suite

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions