Thanks for the help.  I almost have this up and running, but I have
found one preplexing issue.

My current code base has a very extensive test suite.  As part of this
test suite, I have my test fixtures setup and teardown databases,
mappers, and just about every SA related.  This is meant to help keep
each test clean from anything remaining from the previous test.

As part of the setup and teardown for the tests, I explicitly call
sa.orm.clear_mappers() to clear out all mappers that were setup in the
previous tests.  This was not a problem before the declarative code
change-over because each time I setup the DB's for the tests I have
the system call an initialization method that sets up all metadata,
mappers, etc.  But now, with the mappers being created behind the
scenes I don't have any way to force the system to recreate the
metadata or mappers.

Is there some way to "clear" the declarative layer and have it
regenerate all automatically created metadata and mappers?

-Allen

On Mon, Apr 28, 2008 at 5:07 PM, Michael Bayer <[EMAIL PROTECTED]> wrote:
>
>
>  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.
>
>
>
>
>  >
>

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

Reply via email to