SqlQueryBackend

class lsst.daf.butler.registry.queries.SqlQueryBackend(db: Database, managers: RegistryManagerInstances)

Bases: lsst.daf.butler.registry.queries.QueryBackend

An implementation of QueryBackend for SqlRegistry.

Parameters:
db : Database

Object that abstracts the database engine.

managers : RegistryManagerInstances

Struct containing the manager objects that back a SqlRegistry.

Attributes Summary

managers A struct containing the manager instances that back a SQL registry.
universe Definition of all dimensions and dimension elements for this registry.

Methods Summary

resolve_collection_wildcard(expression, *, …) Return the collection records that match a wildcard expression.
resolve_dataset_type_wildcard(expression, …) Return the dataset types that match a wildcard expression.
resolve_single_dataset_type_wildcard(…) Return a single dataset type that matches a wildcard expression.

Attributes Documentation

managers

A struct containing the manager instances that back a SQL registry.

Notes

This property is a temporary interface that will be removed in favor of new methods once the manager and storage classes have been integrated with Relation.

universe

Definition of all dimensions and dimension elements for this registry.

Methods Documentation

resolve_collection_wildcard(expression: Any, *, collection_types: Set[CollectionType] = frozenset({<CollectionType.RUN: 1>, <CollectionType.TAGGED: 2>, <CollectionType.CHAINED: 3>, <CollectionType.CALIBRATION: 4>}), done: set[str] | None = None, flatten_chains: bool = True, include_chains: bool | None = None) → list[CollectionRecord]

Return the collection records that match a wildcard expression.

Parameters:
expression

Names and/or patterns for collections; will be passed to CollectionWildcard.from_expression.

collection_types : collections.abc.Set [ CollectionType ], optional

If provided, only yield collections of these types.

done : set [ str ], optional

A set of collection names that should be skipped, updated to include all processed collection names on return.

flatten_chains : bool, optional

If True (default) recursively yield the child collections of CHAINED collections.

include_chains : bool, optional

If False, return records for CHAINED collections themselves. The default is the opposite of flattenChains: either return records for CHAINED collections or their children, but not both.

Returns
——
records : list [ CollectionRecord ]

Matching collection records.

resolve_dataset_type_wildcard(expression: Any, components: bool | None = None, missing: list[str] | None = None, explicit_only: bool = False) → dict[DatasetType, list[str | None]]

Return the dataset types that match a wildcard expression.

Parameters:
expression

Names and/or patterns for dataset types; will be passed to DatasetTypeWildcard.from_expression.

components : bool, optional

If True, apply all expression patterns to component dataset type names as well. If False, never apply patterns to components. If None (default), apply patterns to components only if their parent datasets were not matched by the expression. Fully-specified component datasets (str or DatasetType instances) are always included.

missing : list of str, optional

String dataset type names that were explicitly given (i.e. not regular expression patterns) but not found will be appended to this list, if it is provided.

explicit_only : bool, optional

If True, require explicit DatasetType instances or str names, with re.Pattern instances deprecated and ... prohibited.

Returns:
dataset_types : dict [ DatasetType, list [ None, str ] ]

A mapping with resolved dataset types as keys and lists of matched component names as values, where None indicates the parent composite dataset type was matched.

resolve_single_dataset_type_wildcard(expression: Any, components: bool | None = None, explicit_only: bool = False) → tuple[DatasetType, list[str | None]]

Return a single dataset type that matches a wildcard expression.

Parameters:
expression

Names and/or patterns for the dataset type; will be passed to DatasetTypeWildcard.from_expression.

components : bool, optional

If True, apply all expression patterns to component dataset type names as well. If False, never apply patterns to components. If None (default), apply patterns to components only if their parent datasets were not matched by the expression. Fully-specified component datasets (str or DatasetType instances) are always included.

explicit_only : bool, optional

If True, require explicit DatasetType instances or str names, with re.Pattern instances deprecated and ... prohibited.

Returns:
single_parent : DatasetType

The matched parent dataset type.

single_components : list [ str | None ]

The matched components that correspond to this parent, or None if the parent dataset type itself was matched.

Notes

This method really finds a single parent dataset type and any number of components, because it’s only the parent dataset type that’s known to registry at all; many callers are expected to discard the single_components return value.