We\'re trying to run SQL files containing multiple insert statements as a single query, but it seems rollback
fails when any of the statements contain an error.
Tried the multi=True
method, but ended up splitting the file by semi and looping through. Obviously not going to work if you have escaped semis, but seemed like the best method for me.
with connection.cursor() as cursor:
for statement in script.split(';'):
if len(statement) > 0:
cursor.execute(statement + ';')