Skip to content

Commit

Permalink
Get the db engine directly from the extensions dictionary.
Browse files Browse the repository at this point in the history
Resolves deprecation of the .db attribute in Flask-SQLAlchemy 3.0.0
  • Loading branch information
woutervanoorschot committed Nov 4, 2022
1 parent 15e8cd8 commit a8aafa7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/flask_marshmallow/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def init_app(self, app):

# If using Flask-SQLAlchemy, attach db.session to SQLAlchemySchema
if has_sqla and "sqlalchemy" in app.extensions:
db = app.extensions["sqlalchemy"].db
db = app.extensions["sqlalchemy"]
if self.SQLAlchemySchema:
self.SQLAlchemySchema.OPTIONS_CLASS.session = db.session
if self.SQLAlchemyAutoSchema:
Expand Down

0 comments on commit a8aafa7

Please sign in to comment.