TableSpec#

class lsst.daf.butler.ddl.TableSpec(fields: Iterable[FieldSpec], *, unique: Iterable[tuple[str, ...]] = (), indexes: Iterable[IndexSpec] = (), foreignKeys: Iterable[ForeignKeySpec] = (), exclusion: Iterable[tuple[str | type[TimespanDatabaseRepresentation], ...]] = (), recycleIds: bool = True, doc: str | None = None)#

Bases: object

A data class used to define a table or table-like query interface.

Parameters#

fieldsIterable [ FieldSpec ]

Specifications for the columns in this table.

uniqueIterable [ tuple [ str ] ], optional

Non-primary-key unique constraints for the table.

indexesIterable [ IndexSpec ], optional

Indexes for the table.

foreignKeysIterable [ ForeignKeySpec ], optional

Foreign key constraints for the table.

exclusionIterable [ tuple [ str or type ] ]

Special constraints that prohibit overlaps between timespans over rows where other columns are equal. These take the same form as unique constraints, but each tuple may contain a single TimespanDatabaseRepresentation subclass representing a timespan column.

recycleIdsbool, optional

If True, allow databases that might normally recycle autoincrement IDs to do so (usually better for performance) on any autoincrement field in this table.

docstr, optional

Documentation for the table.

Attributes Summary

doc

Documentation for the table.

exclusion

Exclusion constraints for the table.

fields

Specifications for the columns in this table.

foreignKeys

Foreign key constraints for the table.

indexes

Indexes for the table.

recycleIds

If True, allow databases that might normally recycle autoincrement IDs to do so (usually better for performance) on any autoincrement field in this table.

unique

Non-primary-key unique constraints for the table.

Methods Summary

fromConfig(config, *args, **kwargs)

Attributes Documentation

doc: str | None = None#

Documentation for the table.

exclusion: set[tuple[str | type[TimespanDatabaseRepresentation], ...]] = <dataclasses._MISSING_TYPE object>#

Exclusion constraints for the table.

Exclusion constraints behave mostly like unique constraints, but may contain a database-native Timespan column that is restricted to not overlap across rows (for identical combinations of any non-Timespan columns in the constraint).

fields: NamedValueSet[FieldSpec] = <dataclasses._MISSING_TYPE object>#

Specifications for the columns in this table.

foreignKeys: list[ForeignKeySpec] = <dataclasses._MISSING_TYPE object>#

Foreign key constraints for the table.

indexes: set[IndexSpec] = <dataclasses._MISSING_TYPE object>#

Indexes for the table.

recycleIds: bool = True#

If True, allow databases that might normally recycle autoincrement IDs to do so (usually better for performance) on any autoincrement field in this table.

unique: set[tuple[str, ...]] = <dataclasses._MISSING_TYPE object>#

Non-primary-key unique constraints for the table.

Methods Documentation

classmethod fromConfig(config: Config, *args: Any, **kwargs: Any) Any#