Skip to content

Commit f2ef848

Browse files
jqxl0205mitsuhiko
authored andcommitted
Let self.Model.metadata.bind ot be self.engine, so that custom sqlalchemy column (eg. geoalchemy) can get correct dialect, otherwise the dialect will be default and str(query) will fail
Signed-off-by: Armin Ronacher <armin.ronacher@active-4.com>
1 parent 08d7be7 commit f2ef848

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

flaskext/sqlalchemy.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,9 @@ def init_app(self, app):
525525
app.config.setdefault('SQLALCHEMY_POOL_TIMEOUT', None)
526526
app.config.setdefault('SQLALCHEMY_POOL_RECYCLE', None)
527527

528+
self.app = app
529+
self.Model.metadata.bind = self.engine
530+
528531
@app.after_request
529532
def shutdown_session(response):
530533
self.session.remove()

0 commit comments

Comments
 (0)