ads slot

Latest Posts:

Срочно нужен инженер схемотехник! Опыт проектирования схем в Altium Designer; ТК; Подробнее здесь

Mike C. Fletcher: Evening Learning; I was hoping to get something done...

Mike C. Fletcher: Evening Learning; I was hoping to get something done...: Mike Bayer mentioned in comments yesterday that one can configure SQLAlchemy to use one session with multiple database connections, so I decided to play with it tonight. This is in the context of a TurboGears 2.1 app with SQLAlchemy 0.5.8, btw.

Documentation for how to setup the mapping isn't particularly helpful about best practice for splitting existing apps across two databases. I spent quite some time playing with multiple DeclarativeBase classes, and eventually just settled on model.init_model( *engines ) creating a mapping from Declarative classes and Tables to the connection which should be used for the table by using introspection on the classes themselves. Once you have the mapping, you pass the mapping into DBSession.configure( binds = your_mapping ).


Share on Google Plus

Автор Expert

Я простой житель планеты земля.

Комментарии

comments powered by HyperComments

Алексей Навальный

Мухамеду Али было 74 года

ali from Mab on Vimeo . Он говорил, что хотел бы дожить до ста лет. Мохаммед Али – один из самых известных боксеров в истории мировог...

Получайте обновления на Email

Проблемы на работе?