Skip to content

Commit

Permalink
fix: DeprecationWarning of SQLAlchemy
Browse files Browse the repository at this point in the history
* Query.get() is deprecated in favor of Session.get()
  • Loading branch information
utnapischtim committed Nov 5, 2024
1 parent 2a4a7af commit b1d7748
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion invenio_rdm_records/records/systemfields/access/owners.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@
#
# This file is part of Invenio.
# Copyright (C) 2021 TU Wien.
# 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.

"""Owners classes for the access system field."""

from invenio_accounts.models import User
from invenio_db import db


class Owner:
Expand Down Expand Up @@ -50,7 +52,7 @@ def resolve(self, raise_exc=False):
return None

elif self.owner_type == "user":
self._entity = User.query.get(self.owner_id)
self._entity = db.session.get(User, self.owner_id)

else:
raise ValueError("unknown owner type: {}".format(self.owner_type))
Expand Down

0 comments on commit b1d7748

Please sign in to comment.