Issue
Tables must have __bind_key__
specified. But I need to work with a remote database that is not created in my Flask app.
Is there an option to use something like this:
SQLALCHEMY_BINDS = {
'remote': REMOTE_DB_URL
}
data = db.session.execute(query, binds='remote')
?
I have not found such examples.
Solution
session = db.session
session.bind = db.get_engine(current_app, 'remote')
data = session.execute(query)
Answered By - zrfnz
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.