From b1d774839f4a03b28daf443982a478b17a1f2224 Mon Sep 17 00:00:00 2001 From: Christoph Ladurner Date: Tue, 1 Oct 2024 15:21:32 +0200 Subject: [PATCH] fix: DeprecationWarning of SQLAlchemy * Query.get() is deprecated in favor of Session.get() --- invenio_rdm_records/records/systemfields/access/owners.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/invenio_rdm_records/records/systemfields/access/owners.py b/invenio_rdm_records/records/systemfields/access/owners.py index 2e7b5269b..0754984c8 100644 --- a/invenio_rdm_records/records/systemfields/access/owners.py +++ b/invenio_rdm_records/records/systemfields/access/owners.py @@ -2,6 +2,7 @@ # # 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. @@ -9,6 +10,7 @@ """Owners classes for the access system field.""" from invenio_accounts.models import User +from invenio_db import db class Owner: @@ -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))