On Wed, Mar 9, 2011 at 2:16 AM, Michael Bayer <mike...@zzzcomputing.com> wrote: > there's no "registry" of tables to mappers. You'd need to track that > yourself, or otherwise scan through all mappers (non-public attribute > sqlalchemy.orm._mapper_registry) looking for tables (each mapper has a > .local_table attribute). Note that many mappers can be created against a > single table. > > To track yourself: > > from sqlalchemy.orm import mapper as _mapper > import collections > > my_registry_of_tables = collections.defaultdict(set) > def mapper(cls, table=None, *arg, **kw): > my_registry_of_tables[table].add(cls) > return _mapper(cls, table, *arg, **kw) > > from sqlalchemy.ext.declarative import declarative_base > Base = declarative_base(mapper=mapper)
Thanks Michael. cheers James -- -- James Mills -- -- "Problems are solved by method" -- 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.