On Apr 8, 8:24 am, Jonathan Vanasco <[email protected]> wrote:
> i do this all the time, but with read/write/config dbs
>
> in the ini, create multiple connect strings:
>
> sqlalchemy.write.url = postgres://artwelove:artwel...@localhost/artwelove
> sqlalchemy.read.url = postgres://artwelove:artwel...@localhost/artwelove
> sqlalchemy.config.url = postgres://artwelove:artwel...@localhost/artwelove
>
> in your environment.load_environment, instantiate a connection for
> each one
>
>     if 'sqlalchemy.write.url' in config:
>         engine_write = sa.engine_from_config(config,
> "sqlalchemy.write.")
>         model.init_engine('write',engine_write)
>
> then use a singleton/factory process to manage the connections
>
> ie:
> import dbFactory
> dbh = dbFactory.getFactory('read')

I do something similar, though I keep all my model and DB stuff out of
the web app and in a separate project.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to