Bug 1303102 - Use autocommit for the run_sql command

This prevents changes from being discarded if the DB connection timed
out between the `.execute()` call being made, and it completing.
This commit is contained in:
Ed Morley 2016-09-15 18:48:47 +01:00
Родитель 9d7102c854
Коммит c8802ef7ef
1 изменённых файлов: 1 добавлений и 1 удалений

Просмотреть файл

@ -75,8 +75,8 @@ class Command(BaseCommand):
)
try:
cursor = conn.cursor()
conn.autocommit(True)
cursor.execute(sql_code)
conn.commit()
self.stdout.write("Sql code executed on {}:".format(datasource))
for row in cursor:
self.stdout.write(" {}".format(row))