Skip to content

Commit

Permalink
Document preconditions for iterating over GeneralQueryResults.
Browse files Browse the repository at this point in the history
GeneralQueryResults.iter_tuple (and DatasetAssociation.from_query_result, which
calls it) assume dataset_id and run columns for the dataset type(s) of
interest. However, these columns do not exist unless the query call
specifically asks for them.
  • Loading branch information
kfindeisen committed Jan 23, 2025
1 parent f4b8f4b commit 8207f27
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
9 changes: 5 additions & 4 deletions python/lsst/daf/butler/_dataset_association.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,11 @@ def from_query_result(
Parameters
----------
result : `GeneralQueryResults`
General query result returned by `Query.general` method. The result
has to include "{dataset_type.name}.timespan" and
"{dataset_type.name}.collection" columns.
result : `~lsst.daf.butler.queries.GeneralQueryResults`
General query result returned by
`Query.general <lsst.daf.butler.queries.Query.general>` method. The
result has to include "dataset_id", "run", "collection", and
"timespan" dataset fields for ``dataset_type``.
dataset_type : `DatasetType`
Dataset type, query has to include this dataset type.
"""
Expand Down
3 changes: 3 additions & 0 deletions python/lsst/daf/butler/queries/_general_query_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ def iter_tuples(self, *dataset_types: DatasetType) -> Iterator[GeneralResultTupl
"""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_types : `DatasetType`
Expand Down

0 comments on commit 8207f27

Please sign in to comment.