Skip to content

Commit

Permalink
fix: LegacyAPIWarning of sqlalchemy
Browse files Browse the repository at this point in the history
* LegacyAPIWarning: The Query.get() method is considered legacy as of
  the 1.x series of SQLAlchemy and becomes a legacy construct in 2.0.
  The method is now available as Session.get() (deprecated since:
  2.0) (Background on SQLAlchemy 2.0 at: https://sqlalche.me/e/b8d9)
  role = current_datastore.role_model.query.get(id_)
  • Loading branch information
utnapischtim committed Nov 5, 2024
1 parent a9d4061 commit a9a74fe
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion invenio_files_rest/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#
# This file is part of Invenio.
# Copyright (C) 2015-2019 CERN.
# Copyright (C) 2024 Graz University of Technology.
#
# Invenio is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
Expand Down Expand Up @@ -43,7 +44,7 @@ def verify_checksum(
:param file_id: The file ID.
"""
f = FileInstance.query.get(uuid.UUID(file_id))
f = db.session.get(FileInstance, uuid.UUID(file_id))

# Anything might happen during the task, so being pessimistic and marking
# the file as unchecked is a reasonable precaution
Expand Down

0 comments on commit a9a74fe

Please # to comment.