Hi Michael,

On Thu, 19 May 2011 16:13:49 -0400, Michael Bayer <mike...@zzzcomputing.com> 
wrote:

> Dont wipe anything clean - keep the state of each set of stuff
> separate.  A global dictionary perhaps, with an record inside for
> each configuration.

Could you elaborate on what you have in mind? The tables contain state
reflecting the underlying database tables, right? Are you saying I
should put all of classes + mappers + tables + metadata inside the
value side of a dictionary? That could be pretty awkward to implement.

> There's also not a use case for the same classes to be mapped to
> different Table objects each time - the classes are designed to be
> mapped to a particular table structure and Table+MetaData only
> represent that structure, nothing else.  If you're just switching
> between database backends, that switching occurs by using a
> different Engine and perhaps a different Session registry.

Well, I do of course create a new engine when I switch from connecting
with database1 to connecting with database2. When a new engine is
created and a connection made, do the table objects automatically
clear themselves of any old information? Maybe I'm just indulging in
wishful thinking here...

Regardless, If I don't recreate the tables, the schema will be wrong,
at least. I'm referring here to the schema field in tables for use
with PostgreSQL, though I don't really understand what it does.

>> So if I am switching data sets, I guess I would need to recreate
>> the tables, presumably by creating a new MetaData.  Since the
>> classes don't change, they don't need to be removed. So, would it
>> sufice to have

> I think you should consider the classes + mappers + tables +
> metadata to be a single fixed structure.  That's how it was designed
> to work - it's decoupled from an actual database connection.

Hmm. Meaning you should be able to transfer the whole thing between
database connections?

                                                       Regards, Faheem

-- 
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 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to