Michael

On Mar 25, 1:27 pm, keith cascio <keithautoma...@gmail.com> wrote:
> However, now that I did, things are more complicated, and SQLAlchemy 0.5 
> complains.
>
> 2010-03-25 13:19:02,049 INFO sqlalchemy.engine.base.Engine.0x...f054 BEGIN
> 2010-03-25 13:19:02,049 INFO sqlalchemy.engine.base.Engine.0x...f054 UPDATE 
> xxx SET yyy=now() WHERE xxx.zzzzz = %s AND xxx.aaaaa = %s
> 2010-03-25 13:19:02,049 INFO sqlalchemy.engine.base.Engine.0x...f054 [193302, 
> None]
> 2010-03-25 13:19:02,050 INFO sqlalchemy.engine.base.Engine.0x...f054 ROLLBACK
> Traceback (most recent call last):
> .
> .
> .
> File "sqlalchemy/orm/mapper.py", line 1401, in _save_obj
> sqlalchemy.orm.exc.ConcurrentModificationError: Updated rowcount 0 does not 
> match number of objects updated 1
>
> I will begin to investigate how to avoid that error.  I'd appreciate any 
> advice or hints.

Perhaps I found the right solution for my case.  Whenever I construct
a new mapped object o, and session.add(o), and session.commit(o), I
also call session.expire(o).  Now my program runs to completion
without fatal errors AND produces correct output AND issues the
minimal number of SELECT statements to the poor database.  That is my
goal.

  -- Keith

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@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.

Reply via email to