On May 12, 2007, at 6:58 AM, Andreas Jung wrote:

> I have the following (scary) use-case:
>
> Table 'media' has 1 : N relationship to table 'history'.
>
> class Media(object):
>
>   def addHistory(self, comment):
>      self.history.append(History(....)))
>
>
> Inside addHistory() I need to get hold of the mapper class History  
> for 'history' in order to append a new items to the media's history.

ok, you mean a "mapped" class, right ?  i.e.the History class.   i  
dont exactly understand why you cant just say "History", so heres the  
most generic way possible to go from 'self' to the class used on a  
relation:

class_mapper(self.__class__).props['history'].mapper.class_





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