You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2019/01/25 13:51:04 UTC

[GitHub] ashb commented on a change in pull request #4584: [AIRFLOW-3741] Add extra config to Oracle hook

ashb 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_r250978334
 
 

 ##########
 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:
   ```suggestion
           if "encoding" in conn.extra_dejson:
   ```
   
   And similar changes for all of the other `if get(x. None)` conditions.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services