Fokko closed pull request #2879: [AIRFLOW-1921] Added support for presto https and user auth URL: https://github.com/apache/incubator-airflow/pull/2879
This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/airflow/hooks/presto_hook.py b/airflow/hooks/presto_hook.py index d6b5293fc0..e2794df071 100644 --- a/airflow/hooks/presto_hook.py +++ b/airflow/hooks/presto_hook.py @@ -21,6 +21,7 @@ from pyhive import presto from pyhive.exc import DatabaseError +from requests.auth import HTTPBasicAuth from airflow.hooks.dbapi_hook import DbApiHook @@ -45,11 +46,17 @@ class PrestoHook(DbApiHook): def get_conn(self): """Returns a connection object""" db = self.get_connection(self.presto_conn_id) + reqkwargs = None + if db.password is not None: + reqkwargs = {'auth': HTTPBasicAuth(db.login, db.password)} return presto.connect( host=db.host, port=db.port, username=db.login, + source=db.extra_dejson.get('source', 'airflow'), + protocol=db.extra_dejson.get('protocol', 'http'), catalog=db.extra_dejson.get('catalog', 'hive'), + requests_kwargs=reqkwargs, schema=db.schema) @staticmethod ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services