From e59aaf8469c7ade4d764e155869e086f4298128b Mon Sep 17 00:00:00 2001 From: John Davis Date: Wed, 27 Sep 2023 16:21:48 -0400 Subject: [PATCH] Fix SA 2.0 ORM usage in model.tags --- lib/galaxy/model/tags.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/galaxy/model/tags.py b/lib/galaxy/model/tags.py index 1b378a534643..739d8528195d 100644 --- a/lib/galaxy/model/tags.py +++ b/lib/galaxy/model/tags.py @@ -287,12 +287,12 @@ def get_tags_str(self, tags): def get_tag_by_id(self, tag_id): """Get a Tag object from a tag id.""" - return self.sa_session.query(galaxy.model.Tag).filter_by(id=tag_id).first() + return self.sa_session.get(galaxy.model.Tag, tag_id) def get_tag_by_name(self, tag_name): """Get a Tag object from a tag name (string).""" if tag_name: - return self.sa_session.query(galaxy.model.Tag).filter_by(name=tag_name.lower()).first() + return self.sa_session.scalars(select(galaxy.model.Tag).filter_by(name=tag_name.lower()).limit(1)).first() return None def _create_tag(self, tag_str: str): @@ -317,7 +317,7 @@ def _create_tag(self, tag_str: str): return tag def _get_tag(self, tag_name): - return self.sa_session.query(galaxy.model.Tag).filter_by(name=tag_name).first() + return self.sa_session.scalars(select(galaxy.model.Tag).filter_by(name=tag_name).limit(1)).first() def _create_tag_instance(self, tag_name): # For good performance caller should first check if there's already an appropriate tag