GeneralQueryResults#

final class lsst.daf.butler.queries.GeneralQueryResults(driver: QueryDriver, tree: QueryTree, spec: GeneralResultSpec)#

Bases: QueryResultsBase

A query for DatasetRef results with a single dataset type.

Parameters#

driverQueryDriver

Implementation object that knows how to actually execute queries.

treeQueryTree

Description of the query as a tree of joins and column expressions. The instance returned directly by the Butler._query entry point should be constructed via make_unit_query_tree.

specGeneralResultSpec

Specification of the query result rows, including output columns, ordering, and slicing.

Notes#

This class should never be constructed directly by users; use Query methods instead.

Attributes Summary

dimensions

All dimensions included in the query's columns.

has_dimension_records

Whether all data IDs in this iterable contain dimension records.

Methods Summary

count(*[, exact, discard])

Count the number of rows this query would return.

iter_tuples(*dataset_types)

Iterate over result rows and return data coordinate, and dataset refs constructed from each row, and an original row.

with_dimension_records()

Return a results object for which has_dimension_records is True.

Attributes Documentation

dimensions#
has_dimension_records#

Whether all data IDs in this iterable contain dimension records.

Methods Documentation

count(*, exact: bool = True, discard: bool = False) int#

Count the number of rows this query would return.

Parameters#

exactbool, optional

If True, run the full query and perform post-query filtering if needed to account for that filtering in the count. If False, the result may be an upper bound.

discardbool, optional

If True, compute the exact count even if it would require running the full query and then throwing away the result rows after counting them. If False, this is an error, as the user would usually be better off executing the query first to fetch its rows into a new query (or passing exact=False). Ignored if exact=False.

Returns#

countint

The number of rows the query would return, or an upper bound if exact=False.

iter_tuples(*dataset_types: DatasetType) Iterator[GeneralResultTuple]#

Iterate over result rows and return data coordinate, and dataset refs constructed from each row, and an original row.

This object has to include “dataset_id” and “run” columns for each type in dataset_types.

Parameters#

*dataset_typesDatasetType

Zero or more types of the datasets to return.

Yields#

row_tupleGeneralResultTuple

Structure containing data coordinate, refs, and a copy of the row.

with_dimension_records() GeneralQueryResults#

Return a results object for which has_dimension_records is True.