Skip to content

Catalog needs a database-identity contract for early cross-catalog validation #1864

Description

@shcheklein

Split out of #1863 (see its review discussion).

DatasetQuery.union/join/subtract validate only Catalog.in_memory (_ensure_same_catalog_mode). Combinations across catalogs that live in different databases but share a mode are accepted and fail much later, deep in SQL execution, with a misleading missing-table error:

Proposal:

  • add Catalog.database_identity (or is_compatible_with(other)) derived from the execution warehouse/database — for SQLite, the normalized db file or shared-memory identity; for server warehouses, the connection identity
  • use it from union, join, subtract instead of the mode flag
  • cover: two different persistent SQLite files (reject early), the same database through two sessions (allowed), distinct in-memory identities (reject early)

This gap predates #1863 for persistent catalogs; the mode check added there intentionally covers only the mixed in-memory/persistent case.

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions