SqlQueryBackend

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

Bases: QueryBackend

An implementation of QueryBackend for SqlRegistry.

Parameters:
dbDatabase

Object that abstracts the database engine.

managersRegistryManagerInstances

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(expression)

Return a single dataset type that matches a wildcard expression.

Attributes Documentation

managers
universe

Methods Documentation

resolve_collection_wildcard(expression: Any, *, collection_types: Set[CollectionType] = frozenset({CollectionType.RUN, CollectionType.TAGGED, CollectionType.CHAINED, CollectionType.CALIBRATION}), 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_typescollections.abc.Set [ CollectionType ], optional

If provided, only yield collections of these types.

doneset [ str ], optional

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

flatten_chainsbool, optional

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

include_chainsbool, 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:
recordslist [ 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.

componentsbool, 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.

missinglist 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_onlybool, optional

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

Returns:
dataset_typesdict [ 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.

componentsbool, 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.

Values other than False are deprecated, and only False will be supported after v26. After v27 this argument will be removed entirely.

explicit_onlybool, optional

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

Returns:
single_parentDatasetType

The matched parent dataset type.

single_componentslist [ 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.