airflow-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From san...@apache.org
Subject incubator-airflow git commit: [AIRFLOW-590] Set module parameter in OracleHook
Date Wed, 02 Nov 2016 07:34:10 GMT
Repository: incubator-airflow
Updated Branches:
  refs/heads/master 0b6ac66e4 -> 2daf7a816


[AIRFLOW-590] Set module parameter in OracleHook

Closes #1848 from gtoonstra/oracle_action_module


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

Branch: refs/heads/master
Commit: 2daf7a8168fc57801e430d78e37ed62ec99d50dc
Parents: 0b6ac66
Author: gtoonstra <gtoonstra@gmail.com>
Authored: Wed Nov 2 00:33:54 2016 -0700
Committer: Siddharth Anand <siddharthanand@yahoo.com>
Committed: Wed Nov 2 00:33:54 2016 -0700

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


http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/2daf7a81/airflow/hooks/oracle_hook.py
----------------------------------------------------------------------
diff --git a/airflow/hooks/oracle_hook.py b/airflow/hooks/oracle_hook.py
index 6556ce7..1386d6d 100644
--- a/airflow/hooks/oracle_hook.py
+++ b/airflow/hooks/oracle_hook.py
@@ -44,6 +44,8 @@ class OracleHook(DbApiHook):
         conn = self.get_connection(self.oracle_conn_id)
         dsn = conn.extra_dejson.get('dsn', None)
         sid = conn.extra_dejson.get('sid', None)
+        mod = conn.extra_dejson.get('module', None)
+
         service_name = conn.extra_dejson.get('service_name', None)
         if dsn and sid and not service_name:
             dsn = cx_Oracle.makedsn(dsn, conn.port, sid)
@@ -53,9 +55,13 @@ class OracleHook(DbApiHook):
             conn = cx_Oracle.connect(conn.login, conn.password, dsn=dsn)
         else:
             conn = cx_Oracle.connect(conn.login, conn.password, conn.host)
+
+        if mod is not None:
+            conn.module = mod
+
         return conn
 
-    def insert_rows(self, table, rows, target_fields = None, commit_every = 1000):
+    def insert_rows(self, table, rows, target_fields=None, commit_every=1000):
         """
         A generic way to insert a set of tuples into a table,
         the whole set of inserts is treated as one transaction


Mime
View raw message