I am using DBPool with pyPgSQL.  I am curious as to how transactions work with DBPool.
 
Suppose I have the following.
 
conn = dbpool.getConnection()
c = conn.cursor()
try:
  c.execute(foo1...) # inserts and updates
  c.execute(foo2...)
  c.execute(foo3...)
  c.close(); conn.commit(); conn.close()
except:
  #log error here
  c.close()
  conn.commit()  # is this needed here?
  conn.close()
 
If one of the execute should throw an exception, will the prceeding execute states before it commit or discard?   is that conn.commit() in my except clause needed?  thanks.
 
Uzo


The Opportunity Gap
 
Between what is and what could be exists a potential gap.
This gap is an opportunity gap; With every passing of time, it closes.
The gap becomes closed, when what was becomes what is,
... OR what was can no longer be what it could be.


Do you Yahoo!?
Check out the new Yahoo! Front Page. www.yahoo.com

Reply via email to