what that should do? An association to a polymorphic object that is not plain-class-hierarchy (which is, several associations, one per subtype)?
i am asking as this seems as another way to do aspects/multiple inheritance; my way is a single association with multiple references (to the multiple possible types) inside it and type-discriminator. while your way is switching the association depending on type discriminator... or am i wrong? On Thursday 03 July 2008 16:31:54 Gaetan de Menten wrote: > Hi list, > > Could anybody tell me what's wrong with the following code? It's > only the code in the poly_assoc example directory (the generic > version) where I'm trying to set the polymorphic part of the > relationship. It gets me the traceback below and I don't really > understand why: > > Traceback (most recent call last): > File "poly_assoc_3.py", line 155, in <module> > sess.save(u2) > File "/home/ged/devel/sqlalchemy/trunk/lib/sqlalchemy/util.py", > line 1550, in func_with_warning > return func(*args, **kwargs) > File > "/home/ged/devel/sqlalchemy/trunk/lib/sqlalchemy/orm/session.py", > line 1055, in save > self._cascade_save_or_update(state, entity_name) > File > "/home/ged/devel/sqlalchemy/trunk/lib/sqlalchemy/orm/session.py", > line 1111, in _cascade_save_or_update > self._save_or_update_impl(state) > File > "/home/ged/devel/sqlalchemy/trunk/lib/sqlalchemy/orm/session.py", > line 1251, in _save_or_update_impl > self._update_impl(state) > File > "/home/ged/devel/sqlalchemy/trunk/lib/sqlalchemy/orm/session.py", > line 1241, in _update_impl > "session." % (mapperutil.state_str(state), state.key)) > sqlalchemy.exc.InvalidRequestError: Could not update instance > '[EMAIL PROTECTED]', identity key (<class > '__main__.GenericAssoc'>, (1,), None); a different instance with > the same identity key already exists in this session. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---