Reputation: 197
i'm currently working on postgresql with django and got some trouble with a try: except: statement where postgre kept old query and blocked everything.
To correct that trouble I found that django.db.connection._rollback() would reset the connection to some point in past allowing me to ask for further queries.
My question is : How far that _rollback() reset ?
Assuming that i've a table Member :
If i manage to create 4 members but that the 5th is already in the DB - i will update it :
for members in member_list:
try:
create_member(member)
excepte blabla, e:
rollback()
update_member()
Will it create the 4 first members ?
Upvotes: 0
Views: 335
Reputation: 50796
A rollback should set the database's state back to point in time when the transaction was started. The start point depends of course on which kind of transaction management you are using - or - when a commit in between happens. You should read the django documentation on transaction management.
Upvotes: 1