Skip to content

Commit

Permalink
fix: LegacyAPIWarning
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)
    return self.user_model.query.get(identifier)
  • Loading branch information
utnapischtim committed Sep 25, 2024
1 parent ebb166e commit 1e59509
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion flask_security/datastore.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1e59509

Please sign in to comment.