ursa.catalog.exceptions¶
Exception types for catalog operations.
The PK-collision taxonomy has two layers:
- class:
CatalogRowExistscarries structuredtable+primary_keyattributes so callers (notably :mod:ursa.register) can introspect the failed insert without parsing a string message.
- class:
CatalogPKConflictis the catalog-internal raise site (used by- class:
~ursa.catalog.Catalog.addand_reject_existing_pks). It inherits from :class:CatalogRowExists, soexcept CatalogRowExistscatches both, andCatalog.add()populates the structured attrs at the existing-row collision site.
Module Contents¶
Data¶
API¶
- ursa.catalog.exceptions.__all__¶
[‘CatalogError’, ‘CatalogNotInitialized’, ‘CatalogPKConflict’, ‘CatalogRowExists’, ‘CatalogSchemaErr…
- exception ursa.catalog.exceptions.CatalogError[source]¶
Bases:
ExceptionBase class for all catalog-layer errors.
Initialization
Initialize self. See help(type(self)) for accurate signature.
- exception ursa.catalog.exceptions.CatalogRowExists(table: str, primary_key: tuple[tuple[str, object], ...])[source]¶
Bases:
ursa.catalog.exceptions.CatalogErrorRaised when an insert violates a table’s primary-key uniqueness.
Phase 1a (M2) is non-idempotent — a re-register with the same primary key always raises. Idempotent re-register semantics are tracked in
ENG-1074 <https://linear.app/constellationlab/issue/ENG-1074>_.Attributes
table: Logical catalog table name (e.g.
"recordings","events"). primary_key: Tuple of(field, value)pairs that identify the conflicting row. Tuple-of-pairs rather thandictso the natural ordering from__primary_key__is preserved in the error message.Initialization
Initialize self. See help(type(self)) for accurate signature.
- exception ursa.catalog.exceptions.CatalogPKConflict(table_or_message: str, primary_key: tuple[tuple[str, object], ...] | None = None)[source]¶
Bases:
ursa.catalog.exceptions.CatalogRowExistsRaised by :meth:
~ursa.catalog.Catalog.addon duplicate primary key.Subclass of :class:
CatalogRowExistsso callers up the stack (notably :mod:ursa.register) canexcept CatalogRowExistsand catch both the register-layer raises and the catalog-internal ones.Constructor accepts either form:
CatalogPKConflict(table, primary_key)— structured form, used byCatalog.add()’s existing-row collision path. Fillstable/primary_keyattributes via the parent.CatalogPKConflict(message)— legacy free-text form, used by the within-batch duplicate path where the message includes"duplicate PK …".tableandprimary_keydefault to empty.
Initialization
Initialize self. See help(type(self)) for accurate signature.
- exception ursa.catalog.exceptions.CatalogSchemaError[source]¶
Bases:
ursa.catalog.exceptions.CatalogErrorRaised by the writer when a row violates an Arrow-level schema invariant the Pydantic model doesn’t enforce. The canonical case is a
TimeWindoworEmbeddingSourceinstance carrying extra fields: Pydantic allowsextra="allow"on these submodels (so legacy reads don’t break), but Arrow struct columns are fixed-schema, so unknown nested keys cannot be persisted.Initialization
Initialize self. See help(type(self)) for accurate signature.
- exception ursa.catalog.exceptions.CatalogNotInitialized[source]¶
Bases:
ursa.catalog.exceptions.CatalogErrorRaised when an operation hits a catalog that has not been opened (no underlying lancedb connection). Mostly defensive —
Catalog.open()runs_ensure_tables()so a fresh instance is always usable.Initialization
Initialize self. See help(type(self)) for accurate signature.