File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -134,6 +134,12 @@ def init_app(self, app: "Flask"):
134134 # If using Flask-SQLAlchemy, attach db.session to SQLAlchemySchema
135135 if has_sqla and "sqlalchemy" in app .extensions :
136136 db = app .extensions ["sqlalchemy" ]
137- self .SQLAlchemySchema .OPTIONS_CLASS .session = db .session
138- self .SQLAlchemyAutoSchema .OPTIONS_CLASS .session = db .session
137+ SQLAlchemySchemaOpts = typing .cast (
138+ sqla .SQLAlchemySchemaOpts , self .SQLAlchemySchema .OPTIONS_CLASS
139+ )
140+ SQLAlchemySchemaOpts .session = db .session
141+ SQLAlchemyAutoSchemaOpts = typing .cast (
142+ sqla .SQLAlchemyAutoSchemaOpts , self .SQLAlchemySchema .OPTIONS_CLASS
143+ )
144+ SQLAlchemyAutoSchemaOpts .session = db .session
139145 app .extensions [EXTENSION_NAME ] = self
You can’t perform that action at this time.
0 commit comments