pgagnon 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_r357992882
##########
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:
`0` as default feels a bit like a magic value. Is there a more descriptive
alternative?
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services