Flask inherited classes of tables in multiple identical databases using __bind_key?

The problem currently with SQLALCHEMY_BINDS is that it is only used for operations like create_all() or drop_all() - you need to change the session binding for that: db.session. Bind = db. Get_engine(app, 'site2') There's work ongoing to change that but it's not in the trunk yet Your code could be like: db.session.

Bind = db. Get_engine(app, orderObject. __bind_key__) order = orderObject.query.

Get(orderid) But remember that this changes the global session and does not reset it, you'd need to do that yourself or write a contextmanager so that you can use the with statement for that If your models are identical over all databases this could also be the way to only have one class for all databases, leave the bind_key and query them with a special bind session object Edit : with the Flask-SQLAlchemy 0.15 Release a simple MyModel.query. Filter(...) is possible for different databases if you defined __bind_key__ properly.

The problem currently with SQLALCHEMY_BINDS is that it is only used for operations like create_all() or drop_all() - you need to change the session binding for that: db.session. Bind = db. Get_engine(app, 'site2') There's work ongoing to change that but it's not in the trunk yet.

Your code could be like: db.session. Bind = db. Get_engine(app, orderObject.

__bind_key__) order = orderObject.query. Get(orderid) But remember that this changes the global session and does not reset it, you'd need to do that yourself or write a contextmanager so that you can use the with statement for that. If your models are identical over all databases this could also be the way to only have one class for all databases, leave the bind_key and query them with a special bind session object.

Edit: with the Flask-SQLAlchemy 0.15 Release a simple MyModel.query. Filter(...) is possible for different databases if you defined __bind_key__ properly.

1 You sir, are a scholar and a gentleman. Thank you! – RustyFluff Aug 1 at 9:58 with the Flask-SQLAlchemy 0.15 Release a simple MyModel.query.

Filter(...) is possible for different databases if you defined _bind_key_ properly. – Christopher Grebs Aug 10 at 10:30.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions