Skip to content

Commit

Permalink
Revert DB Query
Browse files Browse the repository at this point in the history
  • Loading branch information
vinayan3 committed Aug 21, 2024
1 parent 1f471ca commit 9d7b17b
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions pkg/api/aim/dao/repositories/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -398,16 +398,22 @@ func (r RunRepository) SearchRuns(

log.Debugf("Total runs: %d", total)

experimentsSelect := database.DB.Select(
"ID", "Name",
).Where(
&models.Experiment{NamespaceID: namespaceID},
)
// Do not include the filter if there are no ExperimentNames
if len(req.ExperimentNames) > 0 {
experimentsSelect = experimentsSelect.Where(
`"Experiment"."name" IN ?`, req.ExperimentNames,
)
}

tx := r.GetDB().WithContext(ctx).
InnerJoins(
"Experiment",
database.DB.Select(
"ID", "Name",
).Where(
&models.Experiment{NamespaceID: namespaceID},
).Where(
`"Experiment"."name" IN ?`, req.ExperimentNames,
),
experimentsSelect,
).
Order("row_num DESC")

Expand Down

0 comments on commit 9d7b17b

Please sign in to comment.