Re: session_context and multiple SA databases

2007-01-18 Thread Max Ischenko
On Jan 17, 2007, at 6:19 AM, Max Ischenko wrote: TypeError: No configuration has been registered for this process or thread Your CONFIG object is automatically setup for you in paster shell, it won't be when running it from your own script. Can you please explain how should I setup CONFIG

Re: session_context and multiple SA databases

2007-01-17 Thread Max Ischenko
You'll want to setup another session_context similar to how the main one is setup in pylons.database. For example, in one of your models modules: from paste.deploy import CONFIG from sqlalchemy.ext import sessioncontext from pylons.database import app_scope, make_session dburi2 =

Re: session_context and multiple SA databases

2007-01-17 Thread Max Ischenko
Another issue. If I use DynamicMetadata, as recommended in QuickWiki tutorial, how am I supposed to connect it to correct session_context? Do I need to create engine explicitly (via create_engine) and then call meta.connect(engine)? If so, when this should happen? Max.

Re: session_context and multiple SA databases

2007-01-17 Thread Philip Jenvey
On Jan 17, 2007, at 6:19 AM, Max Ischenko wrote: It works, at least if I verify with paster shell. But I tried to write a simple test to assert this behavior and got a strange error: File /home/max/projects/dou-trunk/site/doupy/doupy/tests/functional/ test_db_conn.py, line 2, in ?

session_context and multiple SA databases

2007-01-16 Thread Max Ischenko
Hello, What is a recommended way to work with multiple database through SqlAlachemy? I can use pylons.database.make_session() to create session explicitly but what about automatic management (akin to what session_context provides)? Max --~--~-~--~~~---~--~~

Re: session_context and multiple SA databases

2007-01-16 Thread Philip Jenvey
On Jan 16, 2007, at 5:58 AM, Max Ischenko wrote: Hello, What is a recommended way to work with multiple database through SqlAlachemy? I can use pylons.database.make_session() to create session explicitly but what about automatic management (akin to what session_context provides)?