Hi,

I have a question regarding multi-threading and transactions in the non-ORM 
case.

Assume, we have a global Connection c (with transaction), on which a number 
of insert/update queries are executed and some insert/update queries are 
executed in threads:

Main thread:                     Thread 1:                      Thread 2:
----------------                      -------------                     
 -------------
c.execute(q1)
c.execute(q2)
                                         c'.execute(q3)               
c''.execute(q5)
                                         c'.execute(q4)               
c''.execute(q6)
c.execute(q7)
...

If any of the queries fails, all changes should be rolled back, otherwise 
committed.

Since each thread will need to open its own connection (c' and c'') to the 
DB, how can these "thread-local" transactions be tied to the global 
transaction?
On failure of q3/q4/q5/q6, the local transaction could be rolled back and 
failure signaled to the main thread. However, on success of q3 and q4 (or 
q5 and q6), the local transaction cannot be committed yet until the global 
transaction commits.

Is there some easy mechanism that SQLAlchemy provides for such 
"multi-thread transactions"?

Thanks in advance,
Christian

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to