StaticTablesContext¶
- 
class lsst.daf.butler.registry.interfaces.StaticTablesContext(db: lsst.daf.butler.registry.interfaces._database.Database)¶
- Bases: - object- Helper class used to declare the static schema for a registry layer in a database. - An instance of this class is returned by - Database.declareStaticTables, which should be the only way it should be constructed.- Methods Summary - addInitializer(initializer, None])- Add a method that does one-time initialization of a database. - addTable(name, spec)- Add a new table to the schema, returning its sqlalchemy representation. - addTableTuple(specs, …])- Add a named tuple of tables to the schema, returning their SQLAlchemy representations in a named tuple of the same type. - Methods Documentation - 
addInitializer(initializer: Callable[[lsst.daf.butler.registry.interfaces._database.Database], None]) → None¶
- Add a method that does one-time initialization of a database. - Initialization can mean anything that changes state of a database and needs to be done exactly once after database schema was created. An example for that could be population of schema attributes. - Parameters: - initializer : callable
- Method of a single argument which is a - Databaseinstance.
 
 - 
addTable(name: str, spec: lsst.daf.butler.core.ddl.TableSpec) → sqlalchemy.sql.schema.Table¶
- Add a new table to the schema, returning its sqlalchemy representation. - The new table may not actually be created until the end of the context created by - Database.declareStaticTables, allowing tables to be declared in any order even in the presence of foreign key relationships.
 - 
addTableTuple(specs: Tuple[lsst.daf.butler.core.ddl.TableSpec, ...]) → Tuple[sqlalchemy.sql.schema.Table, ...]¶
- Add a named tuple of tables to the schema, returning their SQLAlchemy representations in a named tuple of the same type. - The new tables may not actually be created until the end of the context created by - Database.declareStaticTables, allowing tables to be declared in any order even in the presence of foreign key relationships.- Notes - specsmust be an instance of a type created by- collections.namedtuple, not just regular tuple, and the returned object is guaranteed to be the same. Because- namedtupleis just a factory for- typeobjects, not an actual type itself, we cannot represent this with type annotations.
 
-