tg2 multiple database connection

9 views
Skip to first unread message

Dakila

unread,
May 25, 2009, 4:44:55 AM5/25/09
to TurboGears
Hi All,

Does anyone have a sample simple quickstarted application that have
multiple database connection? How do you put together the bits and
pieces of information [1,2] regarding multiple database connection.
And how to use them in __init__.py of in the model, once you create a
second MetaData (metadata2)

# If you have multiple databases with overlapping table names, you'll
need a
# metadata for each database. Feel free to rename 'metadata2'.
metadata2 = MetaData()

[1] http://wiki.pylonshq.com/display/pylonsdocs/Using+SQLAlchemy+with+Pylons
[2] http://www.sqlalchemy.org/docs/05/session.html#vertical-partitioning

Regards,
Dax

Mike Driscoll

unread,
Jun 1, 2009, 2:09:06 PM6/1/09
to TurboGears
Dax,
I asked almost the same question 3 days after you did. If someone
tells you offline, please post back or email me and let me know what
you find out as I need to know too. I find it hard to believe that no
one on this list knows how to do this...

Mike

Dzhelil Rufat

unread,
Jul 7, 2009, 12:52:01 PM7/7/09
to TurboGears
Hello,

I am experiencing a similar problem.

I am doing a project which will have multiple versions of the same
sqlite database. Each database file will have the same exact
structure, but will be populated with different data.

I want to be able to reload a different version of the database on the
fly according to user input. Is this currently possible in TG2?

Thanks,
Dzhelil


On Jun 1, 11:09 am, Mike Driscoll <kyoso...@gmail.com> wrote:
> Dax,
>
> On May 25, 3:44 am, Dakila <dak...@gmail.com> wrote:
>
>
>
> > Hi All,
>
> > Does anyone have a sample simple quickstarted application that have
> > multipledatabaseconnection? How do you put together the bits and
> > pieces of information [1,2] regarding multipledatabaseconnection.
> > And how to use them in __init__.py of in the model, once you create a
> > second MetaData (metadata2)
>
> > # If you have multiple databases with overlapping table names, you'll
> > need a
> > # metadata for eachdatabase. Feel free to rename 'metadata2'.
Reply all
Reply to author
Forward
0 new messages