From 1e5950913445a1c05adb04010a1e91b410fbf2a7 Mon Sep 17 00:00:00 2001 From: Christoph Ladurner Date: Wed, 25 Sep 2024 22:55:38 +0200 Subject: [PATCH] fix: LegacyAPIWarning * 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) return self.user_model.query.get(identifier) --- flask_security/datastore.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flask_security/datastore.py b/flask_security/datastore.py index 3d70492c..0aab0ff9 100644 --- a/flask_security/datastore.py +++ b/flask_security/datastore.py @@ -190,7 +190,7 @@ def get_user(self, identifier): from sqlalchemy import func as alchemyFn if self._is_numeric(identifier): - return self.user_model.query.get(identifier) + return self.db.session.get(self.user_model, identifier) for attr in get_identity_attributes(): query = alchemyFn.lower(getattr(self.user_model, attr)) == alchemyFn.lower( identifier