Skip to content

Commit cf7da4d

Browse files
committed
Merge branch 'release_25.1' into dev
2 parents 9e08047 + 156b51b commit cf7da4d

File tree

2 files changed

+19
-13
lines changed

2 files changed

+19
-13
lines changed

lib/galaxy/model/__init__.py

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4742,26 +4742,32 @@ def _touch_collection_update_time_cte(self, session, supports_skip_locked):
47424742
literal(0).label("depth_level"),
47434743
]
47444744

4745-
# Create a single base query that covers both HDA and LDDA cases using OR conditions
4746-
base_query = (
4745+
# Create separate base queries for HDA and LDDA cases and union them
4746+
# We need to wrap the union in a subquery to use it as the anchor for the recursive CTE
4747+
union_query = (
47474748
select(*base_columns)
47484749
.select_from(
4749-
DatasetCollectionElement.__table__.outerjoin(
4750+
DatasetCollectionElement.__table__.join(
47504751
HistoryDatasetAssociation.__table__, DatasetCollectionElement.hda_id == HistoryDatasetAssociation.id
4751-
).outerjoin(
4752-
LibraryDatasetDatasetAssociation.__table__,
4753-
DatasetCollectionElement.ldda_id == LibraryDatasetDatasetAssociation.id,
47544752
)
47554753
)
4756-
.where(
4757-
or_(
4758-
HistoryDatasetAssociation.dataset_id == self.id,
4759-
LibraryDatasetDatasetAssociation.dataset_id == self.id,
4754+
.where(HistoryDatasetAssociation.dataset_id == self.id)
4755+
.union(
4756+
select(*base_columns)
4757+
.select_from(
4758+
DatasetCollectionElement.__table__.join(
4759+
LibraryDatasetDatasetAssociation.__table__,
4760+
DatasetCollectionElement.ldda_id == LibraryDatasetDatasetAssociation.id,
4761+
)
47604762
)
4763+
.where(LibraryDatasetDatasetAssociation.dataset_id == self.id)
47614764
)
4762-
)
4765+
).subquery()
4766+
4767+
# Select from the union subquery to create a proper base query for the CTE
4768+
base_query = select(union_query.c.collection_id, union_query.c.depth_level)
47634769

4764-
# Create the recursive CTE from the single base query
4770+
# Create the recursive CTE from the base query
47654771
collection_hierarchy_cte = base_query.cte(name="collection_hierarchy", recursive=True)
47664772

47674773
# Create aliases for the recursive part

lib/galaxy_test/api/test_workflows.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8738,7 +8738,7 @@ def test_run_workflow_use_cached_job_implicit_conversion_send_to_new_history(sel
87388738
workflow_id = self.workflow_populator.upload_yaml_workflow(wf)
87398739

87408740
# Run workflow first time
8741-
workflow_request: Dict[str, Any] = {
8741+
workflow_request: dict[str, Any] = {
87428742
"inputs": json.dumps({"fastq_input": self._ds_entry(dataset)}),
87438743
"history": f"hist_id={history_id}",
87448744
"inputs_by": "name",

0 commit comments

Comments
 (0)