Skip to content

Commit

Permalink
[AIRFLOW-533] Set autocommit via set_autocommit
Browse files Browse the repository at this point in the history
 Delegate setting autocommit in insert_rows to set_autocommit

Closes apache#1813 from thyming/fix-insert-rows-
autocommit
  • Loading branch information
thyming authored and r39132 committed Nov 15, 2016
1 parent 12e48b4 commit f34b292
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions airflow/hooks/dbapi_hook.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,10 @@ def insert_rows(self, table, rows, target_fields=None, commit_every=1000):
else:
target_fields = ''
conn = self.get_conn()
cur = conn.cursor()
if self.supports_autocommit:
cur.execute('SET autocommit = 0')
self.set_autocommit(conn, False)
conn.commit()
cur = conn.cursor()
i = 0
for row in rows:
i += 1
Expand Down

0 comments on commit f34b292

Please sign in to comment.