From 4e4e88e4953d23211e584c12db86daadcafc2344 Mon Sep 17 00:00:00 2001 From: John Davis Date: Thu, 28 Sep 2023 09:11:56 -0400 Subject: [PATCH] Fix SA2.0 ORM usage in model.metadata --- lib/galaxy/model/metadata.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/galaxy/model/metadata.py b/lib/galaxy/model/metadata.py index ed757314edca..35e7f73762a1 100644 --- a/lib/galaxy/model/metadata.py +++ b/lib/galaxy/model/metadata.py @@ -20,6 +20,7 @@ Union, ) +from sqlalchemy import select from sqlalchemy.orm import object_session from sqlalchemy.orm.attributes import flag_modified @@ -602,9 +603,9 @@ def wrap(self, value, session): if isinstance(value, galaxy.model.MetadataFile) or isinstance(value, MetadataTempFile): return value if isinstance(value, int): - return session.query(galaxy.model.MetadataFile).get(value) + return session.get(galaxy.model.MetadataFile, value) else: - return session.query(galaxy.model.MetadataFile).filter_by(uuid=value).one() + return session.execute(select(galaxy.model.MetadataFile).filter_by(uuid=value)).scalar_one() def make_copy(self, value, target_context: MetadataCollection, source_context): session = target_context._object_session(target_context.parent)