Skip to content

Commit

Permalink
[AIRFLOW-590] Set module parameter in OracleHook
Browse files Browse the repository at this point in the history
Closes apache#1848 from gtoonstra/oracle_action_module
  • Loading branch information
gtoonstra authored and r39132 committed Nov 2, 2016
1 parent 0b6ac66 commit 2daf7a8
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion airflow/hooks/oracle_hook.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ def get_conn(self):
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)
Expand All @@ -53,9 +55,13 @@ def get_conn(self):
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
Expand Down

0 comments on commit 2daf7a8

Please sign in to comment.