[sqlalchemy] Re: Determining class from table

2007-05-24 Thread Eric Ongerth
To amplify/clarify, what I was hoping I'd find was something like the following behavior: m = class_mapper(cls) t = m.local_table t.mapper is m True t.mapper.class_ is cls True ...But the table doesn't have that method mapper on it. I suppose that's because a table can be mapped more than

[sqlalchemy] Re: Determining class from table

2007-05-24 Thread Michael Bayer
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

[sqlalchemy] Re: Determining class from table

2007-05-24 Thread Eric Ongerth
On May 24, 9:06 am, Michael Bayer [EMAIL PROTECTED] wrote: On May 24, 2007, at 11:34 AM, Eric Ongerth wrote: 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,

[sqlalchemy] Re: Determining class from table

2007-05-24 Thread Eric Ongerth
On May 24, 10:39 am, Michael Bayer [EMAIL PROTECTED] wrote: ill observe that the requests for how do i find the X object given the Y object correspond to applications that are dealing with tables/classes anonymously, like people building generic GUIs for traversing a data model. That's

[sqlalchemy] Re: Determining class from table

2007-05-24 Thread Eric Ongerth
On May 24, 1:31 pm, Michael Bayer [EMAIL PROTECTED] wrote: On May 24, 2007, at 2:11 PM, Eric Ongerth wrote: Is there a shortcut to that longer way around? not at the moment. the tables/columns arent optimized for traversal right now. Thanks -- I can certainly accept that. So then, just

[sqlalchemy] Re: Determining class from table

2007-05-24 Thread Michael Bayer
On May 24, 2007, at 5:00 PM, Eric Ongerth wrote: On May 24, 1:31 pm, Michael Bayer [EMAIL PROTECTED] wrote: On May 24, 2007, at 2:11 PM, Eric Ongerth wrote: Is there a shortcut to that longer way around? not at the moment. the tables/columns arent optimized for traversal right now.

[sqlalchemy] Re: Determining class from table

2007-05-24 Thread Eric Ongerth
On May 24, 3:10 pm, Michael Bayer [EMAIL PROTECTED] wrote: uh well lets look at the source code. Column.unique *is* assigned if you send the unique keyword argument. it transforms the unique keyword argument into a UniqueConstraint when the Column is assigned to its Table via _set_parent.