[Sqlalchemy-tickets] [sqlalchemy] #2822: mysql can't rollback all in one transaction
Brought to you by:
zzzeek
|
From: sqlalchemy <mi...@zz...> - 2013-09-11 10:32:22
|
#2822: mysql can't rollback all in one transaction
-------------------------------------+-------------------------------------
Reporter: glongwave | Owner:
Type: defect | Status: new
Priority: medium | Milestone: 0.7.xx
Component: mysql | Severity: no triage selected
Keywords: mysql session | yet
transcaction | Progress State: awaiting triage
-------------------------------------+-------------------------------------
I used one session to insert two records( with same primary key) as
follow:
{{{
session1 = Session()
user1 = User(1, 'user1')
user2 = User(1, 'user2')
try:
with session1.begin(subtransactions=True):
session1.add(user1)
session1.add(user2)
except IntegrityError:
print('get IntegrityError1')
}}}
1) I expect no user can be inserted due to IntegrityError, but I got the
usr1 was inserted .
It seemed that session didn't rollback all the operations.
2) This only occured with mysql. I can't insert user at all with sqlite
with same code.
3) The sqlalchemy version is 0.7.9. Do I miss something or missuse session
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2822>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|