On Jan 24, 3:19 pm, Michael Bayer <[email protected]> wrote: > On Jan 24, 2010, at 4:14 AM, Christoph Burgmer wrote: > > > On Jan 24, 3:52 am, Michael Bayer <[email protected]> wrote: > >> As far as your "pick one table with given name X and ignore the others" > >> behavior that's some kind of registry logic you'd have to build yourself. > > > Is there an easy way to replicate metadata.tables[]? Inserting my own > > dict object instead might not promise future compatibility. I need to > > keep track of new and deleleted table objects. > > its a dictionary that uses table.key as keys and the Table object as values. > table.key as you know is "schema.name" or just "name". that's pretty > much it. The only intricacy with MetaData is that Table objects might > reference each other with ForeignKeys. If you don't have any of those, > tables can be swapped in and out freely.
I have implemented a dictionary that does lazy lookup of Table objects using their simple names and is used now instead of the one provided by MetaData. As data is relatively stable/should be modified in a way stipulated by the library this currently seems enough logic for my use case. A nice gimmick for the future though would be a trigger for syncing updates with the MetaData class. If anybody is interested, source code went into: http://code.google.com/p/cjklib/source/browse/trunk/cjklib/dbconnector.py?spec=svn245&r=245 -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to [email protected]. 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.
