python - How to use multiple Sessions in a pylons app? -


I have read and I get a way to create many engines using technology, but now I seek advice on this Now, to handle the construction of the session for these engines, the session in my project is defined according to the Pilon Conference: myapp.model Imported as .meta.Session = scoped_session (Session Maker ()) and myapp .model.Session . It works fine if there is only one engine.

What is a good, stable approach to defining this for many engines? The engine set can change on runtime, what its value is, so I will need the ability to fly to the new session s without hard coding on the model.

If you want to select a database backend per request, then a good option meta.Session (Bind = Get_engine_for_this_request ()) as the first thing it will create a session with the specified parameter. If you understand your case then you can stick it in the basement controller.

The best method for many backends for a request depends on your specific usage. If all the backends have the same schema, then maybe it would be best to create many scods, one for each backend. When they have different schemas, you can make several metadata objects (or in the case of basic classes declaration) and they can bind them in the engine.


Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -