QueryBackend¶
-
class
lsst.daf.butler.registry.queries.
QueryBackend
¶ Bases:
abc.ABC
An interface for constructing and evaluating the
Relation
objects that comprise registry queries.This ABC is expected to have a concrete subclass for each concrete registry type.
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 ofCHAINED
collections.- include_chains :
bool
, optional If
False
, return records forCHAINED
collections themselves. The default is the opposite offlattenChains
: 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. IfFalse
, never apply patterns to components. IfNone
(default), apply patterns to components only if their parent datasets were not matched by the expression. Fully-specified component datasets (str
orDatasetType
instances) are always included.- missing :
list
ofstr
, 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 explicitDatasetType
instances orstr
names, withre.Pattern
instances deprecated and...
prohibited.
Returns:
-
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. IfFalse
, never apply patterns to components. IfNone
(default), apply patterns to components only if their parent datasets were not matched by the expression. Fully-specified component datasets (str
orDatasetType
instances) are always included.Values other than
False
are deprecated, and onlyFalse
will be supported after v26. After v27 this argument will be removed entirely.- explicit_only :
bool
, optional If
True
, require explicitDatasetType
instances orstr
names, withre.Pattern
instances deprecated and...
prohibited.
Returns: 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.
-