On Oct 28, 2008, at 12:28 AM, Matthias wrote:
> > Ok, the real world structure was a little bit more comnplicated, but > it worked out this way. > There is only one problem left, regarding the the name of the FK > column which is responsible for resolving the inheritance. > For constructing my join condition, i need to know the name of that > column. Sometimes it is id, sometimes it is for example foo_id. > > I searched with > > print dir(class_mapper(MyClass).mapped_table) > print dir(class_mapper(MyClass).local_table) > > and so on... > I did not find a way to resolve the name of the column which is > responsible for inheritance. you can get the full join condition (the onclause) with class_mapper(MyClass).inherit_condition. You can also just join the tables in question together using table1.join(table2) and if the foreign key relation between them is unambiguous, the onclause is generated automatically (which is the same way inherit_condition is determined). --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
