airflow-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bo...@apache.org
Subject [2/4] incubator-airflow git commit: [AIRFLOW-2364] Warn when setting autocommit on a connection which does not support it
Date Mon, 23 Apr 2018 17:08:32 GMT
[AIRFLOW-2364] Warn when setting autocommit on a connection which does not support it


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

Branch: refs/heads/master
Commit: a33b29c8512c599b97e53808ebf796039a89c15c
Parents: 3450f52
Author: Arthur Wiedmer <arthur@apache.org>
Authored: Mon Apr 23 09:42:13 2018 -0700
Committer: Arthur Wiedmer <arthur@apache.org>
Committed: Mon Apr 23 09:52:08 2018 -0700

----------------------------------------------------------------------
 airflow/hooks/dbapi_hook.py | 8 ++++++++
 1 file changed, 8 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/a33b29c8/airflow/hooks/dbapi_hook.py
----------------------------------------------------------------------
diff --git a/airflow/hooks/dbapi_hook.py b/airflow/hooks/dbapi_hook.py
index b6cdff6..25b1588 100644
--- a/airflow/hooks/dbapi_hook.py
+++ b/airflow/hooks/dbapi_hook.py
@@ -173,6 +173,14 @@ class DbApiHook(BaseHook):
                 conn.commit()
 
     def set_autocommit(self, conn, autocommit):
+        """
+        Sets the autocommit flag on the connection
+        """
+        if not self.supports_autocommit and autocommit:
+            self.log.warn(
+                ("%s connection doesn't support "
+                 "autocommit but autocommit activated."),
+                getattr(self, self.conn_name_attr))
         conn.autocommit = autocommit
 
     def get_cursor(self):


Mime
View raw message