Skip to content

Commit

Permalink
Fix SA2.0 ORM usage in model.metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
jdavcs committed Sep 28, 2023
1 parent 51c3731 commit 4e4e88e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/galaxy/model/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
Union,
)

from sqlalchemy import select
from sqlalchemy.orm import object_session
from sqlalchemy.orm.attributes import flag_modified

Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 4e4e88e

Please sign in to comment.