airflow-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [airflow] dggs123 commented on a change in pull request #6822: [AIRFLOW-5616] Refactor presto hook to support transactions.
Date Sun, 15 Dec 2019 17:52:49 GMT
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_r357994715
 
 

 ##########
 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:
   I think `IsolationLevel. isolation_level` won't work because isolation_level is user input
and it's in string format.

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

Mime
View raw message