On May 24, 2007, at 11:34 AM, Eric Ongerth wrote:

>
> I'm stumped on what sounds like a simple question, but haven't been
> able to find an answer yet because the words "class", "table", and
> various forms of "mapper/mapped/mapping" are so common.
>
> If I've got a class, a table, and a mapper that connects the two...
> and then somewhere later on, some function has the table passed to it,
> how can that function determine the class mapped to that table?
>
> I know how to get from a class to a table:
>
> m = class_mapper(cls)
> t = m.local_table
>
> But I haven't been able to go in the other direction.

theres no registry of tables-> mappers, youd have to either track  
that yourself or loop through  
sqlalchemy.orm.mapperlib.mapper_registry.values() and check the  
"mapped_table" property of each one.

--~--~---------~--~----~------------~-------~--~----~
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