> -----Original Message----- > From: sqlalchemy@googlegroups.com > [mailto:sqlalch...@googlegroups.com] On Behalf Of Yannick Gingras > Sent: 09 October 2009 14:43 > To: sqlalchemy@googlegroups.com > Subject: [sqlalchemy] Duck-typing style of relations > > > Greetings Alchemists, > this is more of a general data modeling question but maybe > Alchemy has > a neat trick to resolve this issue. > > It happens quite often that I want to use instances of a class as > attributes of unrelated objects. One example is Addresses. Both > Companies and Persons have addresses and it would be somewhat awkward > to derive both from a common ancestor, even though mixins would do the > trick. However, the concept of mixins is not straightforward to > transpose to data mapping. The Address example could be implemented > as follow: > > [snip]
Mike wrote a blog post about this a while ago: http://techspot.zzzeek.org/?p=13 It even uses Addresses as the example. It's quite old, so some of the syntax will probably need updating, but the basic idea should still hold. Hope that helps, Simon --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---