Skip to content

Commit

Permalink
Ban multiple-dataset-type results in general find-first queries.
Browse files Browse the repository at this point in the history
Supporting these would be extra complexity I don't think we need.
  • Loading branch information
TallJimbo committed Oct 14, 2024
1 parent 8ba6a93 commit 61ef7f7
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions python/lsst/daf/butler/queries/result_specs.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,11 @@ class GeneralResultSpec(ResultSpecBase):
def find_first_dataset(self) -> str | None:
# Docstring inherited.
if self.find_first:
if len(self.dataset_fields) != 1:
raise InvalidQueryError(

Check warning on line 225 in python/lsst/daf/butler/queries/result_specs.py

View check run for this annotation

Codecov / codecov/patch

python/lsst/daf/butler/queries/result_specs.py#L225

Added line #L225 was not covered by tests
"General query with find_first=True cannot have results from multiple "
"dataset searches."
)
(dataset_type,) = self.dataset_fields.keys()
return dataset_type
return None
Expand Down

0 comments on commit 61ef7f7

Please sign in to comment.