Repository: incubator-airflow
Updated Branches:
  refs/heads/master dae8ac3d6 -> 5bb547a85


[AIRFLOW-2597] Restore original dbapi.run() behavior

Closes #3490 from yrqls21/kevin_yang_fix_ci


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

Branch: refs/heads/master
Commit: 5bb547a85e4064dba64980fcdab14e1191ce88c0
Parents: dae8ac3
Author: Kevin Yang <kevin.y...@airbnb.com>
Authored: Tue Jun 12 08:02:16 2018 +0100
Committer: Kaxil Naik <kaxiln...@apache.org>
Committed: Tue Jun 12 08:02:16 2018 +0100

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


http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/5bb547a8/airflow/hooks/dbapi_hook.py
----------------------------------------------------------------------
diff --git a/airflow/hooks/dbapi_hook.py b/airflow/hooks/dbapi_hook.py
index 09dbb83..05d2084 100644
--- a/airflow/hooks/dbapi_hook.py
+++ b/airflow/hooks/dbapi_hook.py
@@ -169,10 +169,9 @@ class DbApiHook(BaseHook):
                     else:
                         cur.execute(s)
 
-            should_commit = getattr(conn, 'autocommit',
-                                    False) or not self.supports_autocommit
-
-            if should_commit:
+            # If autocommit was set to False for db that supports autocommit,
+            # or if db does not supports autocommit, we do a manual commit.
+            if not getattr(conn, 'autocommit', False):
                 conn.commit()
 
     def set_autocommit(self, conn, autocommit):

Reply via email to