[SQLObject] sqlite transaction ghost?? (cacheValues=False)
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Kumar M. <kum...@gm...> - 2006-07-06 20:29:45
|
this is driving me nuts! After re-reading the docs and the code itself I can't find any reason why this should be happening (below). Specifically, the first commited insert comes back to life after the second transaction is rolled back. Does anyone have any suggestions or insight? SQLObject-0.8dev_r1814 thanks in advance, Kumar _ from sqlobject import * class Person(SQLObject): class sqlmeta: cacheValues = False name = StringCol() conn = connectionForURI('sqlite:/:memory:') print conn.getConnection() conn.debug = 1 Person._connection = conn Person.createTable() trans = conn.transaction() new_p = Person(connection=trans, name='bob') trans.commit() print list(Person.select()) Person.clearTable() print list(Person.select()) trans = conn.transaction() new_p = Person(connection=trans, name='andy') print list(Person.select()) trans.rollback() print list(Person.select()) >>> test_sqlite_trans.py <pysqlite2.dbapi2.Connection object at 0x562020> 2/Query : CREATE TABLE person ( id INTEGER PRIMARY KEY, name TEXT ) 2/QueryR : CREATE TABLE person ( id INTEGER PRIMARY KEY, name TEXT ) 3/QueryIns: INSERT INTO person (name) VALUES ('bob') 3/QueryOne: SELECT name FROM person WHERE id = (1) 3/QueryR : SELECT name FROM person WHERE id = (1) 3/COMMIT : 4/Select : SELECT person.id, person.name FROM person WHERE 1 = 1 4/QueryR : SELECT person.id, person.name FROM person WHERE 1 = 1 5/QueryOne: SELECT name FROM person WHERE id = (1) 5/QueryR : SELECT name FROM person WHERE id = (1) [<Person 1 name='bob'>] 6/Query : DELETE FROM person 6/QueryR : DELETE FROM person 7/Select : SELECT person.id, person.name FROM person WHERE 1 = 1 7/QueryR : SELECT person.id, person.name FROM person WHERE 1 = 1 [] 8/QueryIns: INSERT INTO person (name) VALUES ('andy') 8/QueryOne: SELECT name FROM person WHERE id = (1) 8/QueryR : SELECT name FROM person WHERE id = (1) 9/Select : SELECT person.id, person.name FROM person WHERE 1 = 1 9/QueryR : SELECT person.id, person.name FROM person WHERE 1 = 1 10/QueryOne: SELECT name FROM person WHERE id = (1) 10/QueryR : SELECT name FROM person WHERE id = (1) [<Person 1 name='andy'>] 10/ROLLBACK: 11/Select : SELECT person.id, person.name FROM person WHERE 1 = 1 11/QueryR : SELECT person.id, person.name FROM person WHERE 1 = 1 12/QueryOne: SELECT name FROM person WHERE id = (1) 12/QueryR : SELECT name FROM person WHERE id = (1) [<Person 1 name='bob'>] |