DatasetRegistryStorage¶
-
class
lsst.daf.butler.registry.queries.DatasetRegistryStorage(connection: sqlalchemy.engine.base.Connection, universe: lsst.daf.butler.core.dimensions.universe.DimensionUniverse, tables: Mapping[str, sqlalchemy.sql.selectable.FromClause], *, collections: lsst.daf.butler.registry.interfaces._collections.CollectionManager)¶ Bases:
objectAn object managing
datasetand related tables in aRegistry.Parameters: - connection :
sqlalchemy.engine.Connection A SQLAlchemy connection object, typically shared with the
Registrythat will own the storage instances.- universe :
DimensionUniverse The set of all dimensions for which storage instances should be constructed.
- tables :
dict A dictionary mapping table name to a
sqlalchemy.sql.FromClauserepresenting that table.
Notes
Future changes will convert this concrete class into a polymorphic hierarchy modeled after
DimensionRecordStorage, with many moreSqlRegistrymethod implementations delegating to it. Its interface may change significantly at the same time. At present, this functionality has been factored out ofSqlRegistry(with a bit of duplication) to allow the initialQueryBuilderdesign and implementation to be more forward-looking.Methods Summary
fetchDatasetTypes(expression)Retrieve DatasetTypeinstances from the database matching an expression.getDatasetSubquery(datasetType, *, …)Return a SQL expression that searches for a dataset of a particular type in one or more collections. Methods Documentation
-
fetchDatasetTypes(expression: Any = Ellipsis) → Iterator[lsst.daf.butler.core.datasets.type.DatasetType]¶ Retrieve
DatasetTypeinstances from the database matching an expression.Parameters: - expression
An expression indicating the dataset type(s) to fetch. See DatasetType expressions for more information.
Yields: - datasetType
A dataset matching the given argument.
-
getDatasetSubquery(datasetType: lsst.daf.butler.core.datasets.type.DatasetType, *, collections: Any, isResult: bool = True, addRank: bool = False) → sqlalchemy.sql.selectable.FromClause¶ Return a SQL expression that searches for a dataset of a particular type in one or more collections.
Parameters: - datasetType :
DatasetType Type of dataset to search for. Must be a true
DatasetType; callfetchDatasetTypesfirst to expand an expression if desired.- collections
An expression describing the collections to search and any restrictions on the dataset types to search within them. See Collection expressions for more information.
- isResult :
bool, optional If
True(default), include thedataset_idcolumn in the result columns of the query.- addRank :
bool, optional If
True(Falseis default), also include a calculated column that ranks the collection in which the dataset was found (lower is better). Requires thatcollectionsmust be an ordered expression (regular expressions andare not allowed).
Returns: - subquery :
sqlalchemy.sql.FromClause Named subquery or table that can be used in the FROM clause of a SELECT query. Has at least columns for all dimensions in
datasetType.dimensions; may have additional columns depending on the values ofisResultandaddRank.
- datasetType :
- connection :