I have tried using 'SAVEPOINT' transactions (via 'session.begin_nested') 
with a 'SQLite' database connection, but got an exception when a 
'session.add()', triggered an integrity error, nstead of the expected 
'ROLLBACK TO SAVEPOINT':

The logged statements are:

BEGIN (implicit)
SAVEPOINT sa_savepoint_1
()
INSERT INTO table (col_id, col_a, col_b, col_c) VALUE (?, ?, ?, ?)
(1, None, None, None)
ROLLBACK TO SAVEPOINT sa_savepoint_1
()
ROLLBACK TO SAVEPOINT sa_savepoint_1
()

which triggers:

OperationalError: (OperationalError) no such savepoint: sa_savepoint_1 
u'ROLLBACK TO SAVEPOINT sa_savepoint_1' ()

(I can attach the whole traceback if necessary).

It seems that the error is triggered because the 'ROLLBACK TO SAVEPOINT' is 
executed twice.

I am aware that SAVEPOINT support is relatively recent in SQLite and that 
transaction isolation levels in SQLite are also a rather intricate affair.

Thanks in advance for any feedback about this issue.

--Pedro.

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/sqlalchemy/-/BiOjC1P1xP0J.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to