From: Mike Driscoll <kyoso...@gmail.com>
Date: Tue, 9 Jun 2009 07:10:22 -0700 (PDT)
Local: Tues, Jun 9 2009 10:10 am
Subject: Re: How to setup multiple databases in TG2
For the record, this was resolved. I didn't know how to set up the
second session object. Thanks!
Mike
On Jun 5, 2:06 pm, percious <ch...@percious.com> wrote:
> It's not too bad, but you have to do your own custom app setup, and
> modify your init_model stuff to create multiple transaction manager. > app_cfg.py:
> from webapp.model import init_model
> class MyAppConfig(AppConfig):
> # Pass the engine to initmodel, to be able to introspect
> base_config = MyAppConfig()
> model/__init__.py:
> import model.users
> from model.users.mappers import *
> from zope.sqlalchemy import ZopeTransactionExtension
> # Global session manager. DBSession() returns the session object
> DBSession = UsersDBSession = scoped_session(maker)
> SamplesDBSession = scoped_session(maker3)
> def init_model(users_engine, samples_engine):
> global UsersDBSession, SamplesDBSession, users_metadata,
> UsersDBSession.configure(bind=users_engine)
> users_metadata.bind = users_engine
> This is sort of an off-the cuff answer, we will provide a better one
> Come find me on IRC if you need some more help.
> cheers.
> On Jun 4, 10:31 am, Mike Driscoll <kyoso...@gmail.com> wrote:
> > Hi,
> > According to Mark Ramm's blog, supporting multiple databases is
> > I "think" I need to put multiple sqlalchemy.url's in my
> > I'm pretty sure the init_model came from Perkins. Maybe he can tell me
> > That would be great!
> > Thanks,
> > Mike
> > On May 28, 12:47 pm, Mike Driscoll <kyoso...@gmail.com> wrote:
> > > Hi,
> > > I am having a little trouble wrapping my head around how to configure
> > > I assume I need to comment out this line:
> > > metadata = DeclarativeBase.metadata
> > > and instead create three metadata instances based on MetaData(),
> > > Finally, as I understand it, I can use the "init_model" function to do
> > > Hopefully that stuff makes sense. I am using Python 2.5 and TG2 in a
> > > Thanks!
> > > Mike
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||