7 messages in com.googlegroups.sqlalchemy[sqlalchemy] Re: Using declarative wh...
FromSent OnAttachments
Allen Bierbaum27 Apr 2008 05:24 
Michael Bayer27 Apr 2008 16:27 
Allen Bierbaum28 Apr 2008 14:42 
Michael Bayer28 Apr 2008 15:06 
Allen Bierbaum05 May 2008 14:04 
Michael Bayer05 May 2008 14:28 
Allen Bierbaum05 May 2008 15:13 
Subject:[sqlalchemy] Re: Using declarative when imports happen before create_engine() ??
From:Michael Bayer (mike@zzzcomputing.com)
Date:04/28/2008 03:06:47 PM
List:com.googlegroups.sqlalchemy

On Apr 28, 2008, at 5:42 PM, Allen Bierbaum wrote:

So, if I understand this right, I could import a "base" module that does a lazy creation of the Base class with a metadata object and then just use that base class everywhere I need it for the declarative class definitions. Then at a later time (before I use the mapped classes), I could go and "bind" the metadata for the Base class to an engine for use.

Correct? (I apologize if I used the terms incorrectly).

If this is true, then I think I see how I can solve my problem.

thats right. the whole idea of "declarative_base" is that its just a common base class from which all your other classes inherit. then you can plug whatever engine configuration is needed at any point in time and it will become active for all base-inheriting classes.