Repository: incubator-airflow
Updated Branches:
  refs/heads/master 65b6ceae7 -> 1e82e11ae


[AIRFLOW-766] Skip conn.commit() when in Auto-commit


Project: http://git-wip-us.apache.org/repos/asf/incubator-airflow/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-airflow/commit/3450f526
Tree: http://git-wip-us.apache.org/repos/asf/incubator-airflow/tree/3450f526
Diff: http://git-wip-us.apache.org/repos/asf/incubator-airflow/diff/3450f526

Branch: refs/heads/master
Commit: 3450f526cec894cc7beceeae18f9d54cb2ae7520
Parents: 1d3bb54
Author: Arthur Wiedmer <[email protected]>
Authored: Mon Apr 23 09:41:56 2018 -0700
Committer: Arthur Wiedmer <[email protected]>
Committed: Mon Apr 23 09:42:10 2018 -0700

----------------------------------------------------------------------
 airflow/hooks/dbapi_hook.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/3450f526/airflow/hooks/dbapi_hook.py
----------------------------------------------------------------------
diff --git a/airflow/hooks/dbapi_hook.py b/airflow/hooks/dbapi_hook.py
index a9f4e43..b6cdff6 100644
--- a/airflow/hooks/dbapi_hook.py
+++ b/airflow/hooks/dbapi_hook.py
@@ -7,9 +7,9 @@
 # to you under the Apache License, Version 2.0 (the
 # "License"); you may not use this file except in compliance
 # with the License.  You may obtain a copy of the License at
-# 
+#
 #   http://www.apache.org/licenses/LICENSE-2.0
-# 
+#
 # Unless required by applicable law or agreed to in writing,
 # software distributed under the License is distributed on an
 # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -169,7 +169,8 @@ class DbApiHook(BaseHook):
                     else:
                         cur.execute(s)
 
-            conn.commit()
+            if not conn.autocommit:
+                conn.commit()
 
     def set_autocommit(self, conn, autocommit):
         conn.autocommit = autocommit

Reply via email to