I'm trying to lock rows when I select because I intend to update them 
shortly thereafter. I don't want another session in another process to 
simultaneously be reading/updating. In code:

# ... all necessary setup and Session creation
session = Session()

with session.no_autoflush:

   session.begin_nested()
   objects_protected_from_concurrent_access = 
session.query(Object).with_for_update().all()
   # ... edit some of the objects here
   objects_protected_from_concurrent_access[0].field_one += 1
   session.commit()

But for some reason on the `with_for_update()`, the connection hangs until 
a timeout error (1205 Operational Error) occurs. There's no other processes 
talking to the database. Checking MySQL's 

   SHOW PROCESSLIST;

Reveals nothing unexpected (no processes except Sequel Pro before, then1 
process from the box I'm running SQLAlchemy on, and 1 making the SHOW 
PROCESSLIST query from Sequel Pro afterwards).

How can I best do what I'm trying to do? And is what I'm seeing a bug or a 
feature? 

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to