Skip to content

Commit

Permalink
Fix SA2.0 usage in managers.history_contents
Browse files Browse the repository at this point in the history
  • Loading branch information
jdavcs committed Oct 25, 2023
1 parent ab7a7b7 commit 8735f50
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions lib/galaxy/managers/history_contents.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,31 +407,31 @@ def _contained_id_map(self, id_list):
if not id_list:
return []
component_class = self.contained_class
query = (
self._session()
.query(component_class)
.filter(component_class.id.in_(id_list)) # type: ignore[attr-defined]
stmt = (
select(component_class)
.where(component_class.id.in_(id_list)) # type: ignore[attr-defined]
.options(undefer(component_class._metadata))
.options(joinedload(component_class.dataset).joinedload(model.Dataset.actions))
.options(joinedload(component_class.tags))
.options(joinedload(component_class.annotations)) # type: ignore[attr-defined]
)
return {row.id: row for row in query.all()}
result = self._session().scalars(stmt).unique()
return {row.id: row for row in result}

def _subcontainer_id_map(self, id_list, serialization_params=None):
"""Return an id to model map of all subcontainer-type models in the id_list."""
if not id_list:
return []
component_class = self.subcontainer_class
query = (
self._session()
.query(component_class)
.filter(component_class.id.in_(id_list))
stmt = (
select(component_class)
.where(component_class.id.in_(id_list))
.options(joinedload(component_class.collection))
.options(joinedload(component_class.tags))
.options(joinedload(component_class.annotations))
)
return {row.id: row for row in query.all()}
result = self._session().scalars(stmt).unique()
return {row.id: row for row in result}


class HistoryContentsSerializer(base.ModelSerializer, deletable.PurgableSerializerMixin):
Expand Down

0 comments on commit 8735f50

Please sign in to comment.