Skip to content

Commit

Permalink
Use subquery instead of join
Browse files Browse the repository at this point in the history
  • Loading branch information
omar-selo committed Jun 19, 2023
1 parent 08cf29b commit b42a0e9
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions backend/test_observer/data_access/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@ def get_artefacts_by_family_name(
query = (
select(Artefact)
.join(Stage)
.join(Family)
.where(Artefact.stage.has(Family.name == family_name))
.where(Stage.family_id.in_(select(Family.id).where(Family.name == family_name)))
)
if latest_only:
query = query.distinct(
Expand Down

0 comments on commit b42a0e9

Please sign in to comment.