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/12/15 17:51:29 UTC

[GitHub] [airflow] dggs123 commented on a change in pull request #6822: [AIRFLOW-5616] Refactor presto hook to support transactions.

dggs123 commented on a change in pull request #6822: [AIRFLOW-5616] Refactor presto hook to support transactions.
URL: https://github.com/apache/airflow/pull/6822#discussion_r357994649
 
 

 ##########
 File path: airflow/hooks/presto_hook.py
 ##########
 @@ -44,18 +45,22 @@ class PrestoHook(DbApiHook):
     def get_conn(self):
         """Returns a connection object"""
         db = self.get_connection(self.presto_conn_id)
-        reqkwargs = None
+        auth = None
         if db.password is not None:
-            reqkwargs = {'auth': HTTPBasicAuth(db.login, db.password)}
-        return presto.connect(
+            auth = prestodb.auth.BasicAuthentication(db.login, db.password)
+
+        isolation_level = db.extra_dejson.get('isolation_level', 'AUTOCOMMIT').upper()
+        return prestodb.dbapi.connect(
             host=db.host,
             port=db.port,
-            username=db.login,
+            user=db.login,
             source=db.extra_dejson.get('source', 'airflow'),
-            protocol=db.extra_dejson.get('protocol', 'http'),
+            http_scheme=db.extra_dejson.get('protocol', 'http'),
             catalog=db.extra_dejson.get('catalog', 'hive'),
-            requests_kwargs=reqkwargs,
-            schema=db.schema)
+            schema=db.schema,
+            auth=auth,
+            isolation_level=getattr(IsolationLevel, isolation_level, 0)
 
 Review comment:
   Will replace it with IsolationLevel.AUTOCOMMIT.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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