zhongjiajie commented on a change in pull request #4584: [AIRFLOW-3741] Add 
extra config to Oracle hook
URL: https://github.com/apache/airflow/pull/4584#discussion_r251052417
 
 

 ##########
 File path: airflow/hooks/oracle_hook.py
 ##########
 @@ -50,20 +50,61 @@ def get_conn(self):
         as in ``{ "dsn":"some.host.address" , 
"service_name":"some.service.name" }``
         """
         conn = self.get_connection(self.oracle_conn_id)
+        conn_config = {
+            'user': conn.login,
+            'password': conn.password or ''
+        }
         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)
-            conn = cx_Oracle.connect(conn.login, conn.password, dsn=dsn)
+            conn_config['dsn'] = cx_Oracle.makedsn(dsn, conn.port, sid)
         elif dsn and service_name and not sid:
-            dsn = cx_Oracle.makedsn(dsn, conn.port, service_name=service_name)
-            conn = cx_Oracle.connect(conn.login, conn.password, dsn=dsn)
+            conn_config['dsn'] = cx_Oracle.makedsn(dsn, conn.port, 
service_name=service_name)
         else:
-            conn = cx_Oracle.connect(conn.login, conn.password, conn.host)
+            conn_config['dsn'] = conn.host
 
+        if conn.extra_dejson.get('encoding', None):
 
 Review comment:
   fix

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to