diff --git a/lib/galaxy/managers/jobs.py b/lib/galaxy/managers/jobs.py index 9a0da71b5003..d59daf5fd91e 100644 --- a/lib/galaxy/managers/jobs.py +++ b/lib/galaxy/managers/jobs.py @@ -513,7 +513,7 @@ def replace_dataset_ids(path, key, value): e = aliased(model.HistoryDatasetAssociation) query = query.add_columns(a.dataset_collection_element_id) query = ( - query.join(a) + query.join(a, a.job_id == model.Job.id) .join(b, b.id == a.dataset_collection_element_id) .join( c,