Michael Bayer ha scritto: > that is your own application changing the primary key of a loaded > instance, which is a feature very old versions of SQLAlchemy did not > support. Upgrade to any recent version of 0.4 or 0.5 and you wont > have that issue anymore. > I think I don't want to change this behavior , Michael, Simply I would like to realize that changes was done at current loaded instance to avoid flush it.
Here another similar error when I try to flush an instance already flushed... File "/usr/lib/python2.4/site-packages/sqlalchemy/ext/assignmapper.py", line 7, in do return getattr(query, name)(*args, **kwargs) File "/usr/lib/python2.4/site-packages/sqlalchemy/orm/query.py", line 114, in get key = self.mapper.identity_key(ident) File "/usr/lib/python2.4/site-packages/sqlalchemy/orm/mapper.py", line 992, in identity_key return self.identity_key_from_primary_key(primary_key) File "/usr/lib/python2.4/site-packages/sqlalchemy/orm/mapper.py", line 959, in identity_key_from_primary_key return (self.class_, tuple(util.to_list(primary_key)), self.entity_name) TypeError: iteration over non-sequence Is there any property in the instance to see its state before flushing it? j > On May 20, 2009, at 1:45 AM, jo wrote: > > >> Hello all, >> >> I have the following problem. >> While I'm working in my session, someone change my instance identity. >> >> I would like to avoid this. >> Is there a way to understand if was there any change before flushing? >> >> This is the message: >> >> >> File "/usr/lib/python2.4/site-packages/sqlalchemy/orm/mapper.py", >> line 1078, in save_obj >> raise exceptions.FlushError("Can't change the identity of >> instance %s in session (existing identity: %s; new identity: %s)" % >> (mapperutil.instance_str(obj), obj._instance_key, instance_key)) >> FlushError: Can't change the identity of instance spe...@0x5cc4590 >> in session >> (existing identity: (<class >> 'sicer.BASE.model.tabelleCodifica.specie.Specie'>, (u'0141',), None); >> new identity: (<class >> 'sicer.BASE.model.tabelleCodifica.specie.Specie'>, (u'08',), None)) >> >> >> thank you for any help >> >> j >> >> >> > > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---