I've a small program that inserts a couple of thousand rows into
a postgres database. It appears that transaction handling is
not working as I can see intermediate rows in the database
before the program has committed them. I believe that I'm following
the correct sequence of commands:
conn = connectionForURI("postgres://wkv@localhost/testdb")
class WKVTestTable(SQLObject):
_connection = conn
_table = 'testtable'
id = IntCol(dbName='testid')
officeid = IntCol(dbName='officeid')
pointid = IntCol(dbName='pointid')
dest = StringCol(length=1, varchar=False, dbName='dest')
origin = StringCol(length=1, varchar=False, dbName='origin')
createdate = DateCol(dbName='createdate', default=func.CURRENT_DATE)
sourcedate = DateCol(dbName='sourcedate', default=None)
trans = WKVTestTable._connection.transaction()
for i in xrange(1000):
newrec = WKVTestTable(...)
trans.commit()
I did not specify _cacheValues=False as that would seem to only
apply to a multi access environment (perhaps I'm mistaken?)
I've updated to revision 126 just now and still no joy. Is
autocommit being set on the connection? Postgresql V7.3.4 on
RH 9, psycopg-1.1.11-py2.2_RH9_wkv1
Any suggestions?
Thanks,
William.
|