ParentDatasetQueryResults¶
-
class
lsst.daf.butler.registry.queries.ParentDatasetQueryResults(db: lsst.daf.butler.registry.interfaces._database.Database, query: lsst.daf.butler.registry.queries._query.Query, *, components: Sequence[Optional[str]], records: Optional[Mapping[str, Mapping[tuple, lsst.daf.butler.core.dimensions._records.DimensionRecord]]] = None)¶ Bases:
lsst.daf.butler.registry.queries.DatasetQueryResultsAn object that represents results from a query for datasets with a single parent
DatasetType.Parameters: - db :
Database Database engine to execute queries against.
- query :
Query Low-level query object that backs these results.
query.datasetTypewill be the parent dataset type for this object, and may not beNone.- components :
Sequence[strorNone] Names of components to include in iteration.
Nonemay be included (at most once) to include the parent dataset type.- records :
Mapping, optional Mapping containing
DimensionRecordobjects for all dimensions and all data IDs this query will yield. IfNone(default),DataCoordinate.hasRecordswill returnFalsefor all nested data IDs. This is a nested mapping withstrnames of dimension elements as outer keys,DimensionRecordinstances as inner values, andtuple(record.dataId.values())for the inner keys / outer values (whererecordis the innermostDimensionRecordinstance).
Attributes Summary
dataIdsA lazy-evaluation object representing a query for the just the data IDs of the datasets that would be returned by this query ( DataCoordinateQueryResults).parentDatasetTypeThe parent dataset type for all datasets in this iterable ( DatasetType).Methods Summary
byParentDatasetType()Group results by parent dataset type. expanded()Return a DatasetQueryResultsfor whichDataCoordinate.hasResultsreturnsTruefor all data IDs in returnedDatasetRefobjects.materialize()Insert this query’s results into a temporary table. withComponents(components)Return a new query results object for the same parent datasets but different components. Attributes Documentation
-
dataIds¶ A lazy-evaluation object representing a query for the just the data IDs of the datasets that would be returned by this query (
DataCoordinateQueryResults).The returned object is not in general
zip-iterable withself; it may be in a different order or have (or not have) duplicates.
-
parentDatasetType¶ The parent dataset type for all datasets in this iterable (
DatasetType).
Methods Documentation
-
byParentDatasetType() → Iterator[lsst.daf.butler.registry.queries._results.ParentDatasetQueryResults]¶ Group results by parent dataset type.
Returns: - iter :
Iterator[ParentDatasetQueryResults] An iterator over
DatasetQueryResultsinstances that are each responsible for a single parent dataset type (either just that dataset type, one or more of its component dataset types, or both).
- iter :
-
expanded() → lsst.daf.butler.registry.queries._results.ParentDatasetQueryResults¶ Return a
DatasetQueryResultsfor whichDataCoordinate.hasResultsreturnsTruefor all data IDs in returnedDatasetRefobjects.Returns: - expanded :
DatasetQueryResults Either a new
DatasetQueryResultsinstance orself, if it is already expanded.
Notes
As with
DataCoordinateQueryResults.expanded, it may be more efficient to callmaterializebefore expanding data IDs for very large result sets.- expanded :
-
materialize() → Iterator[lsst.daf.butler.registry.queries._results.ParentDatasetQueryResults]¶ Insert this query’s results into a temporary table.
Returns: - context :
typing.ContextManager[DatasetQueryResults] A context manager that ensures the temporary table is created and populated in
__enter__(returning a results object backed by that table), and dropped in__exit__. Ifselfis already materialized, the context manager may do nothing (reflecting the fact that an outer context manager should already take care of everything else).
- context :
-
withComponents(components: Sequence[Optional[str]]) → lsst.daf.butler.registry.queries._results.ParentDatasetQueryResults¶ Return a new query results object for the same parent datasets but different components.
- db :