Forráskód Böngészése

HUE-1246 [presto] Support additional arguments for pyhive sqlalchemy library (#1250)

Co-authored-by: Ravi Kanth Devanaboyina <rdevanaboyina@SJCDEVARA02-MAC.local>
rdeva 5 éve
szülő
commit
cdbe8ae145

+ 6 - 0
desktop/conf.dist/hue.ini

@@ -1029,6 +1029,12 @@
     # # options='{"url": "presto://localhost:8080/hive/default", "has_impersonation": true}'
     # ## Kerberos.
     # # options='{"url": "presto://localhost:8080/hive/default?KerberosKeytabPath=/path/to/keytab&KerberosPrincipal=principal&KerberosRemoteServiceName=service&protocol=https"'
+    # ## LDAPS enabled over HTTPS.
+    # # options='{"url": "presto://username:password@localhost:8443/tpch/default","connect_args":"{\"protocol\": \"https\"}"}'
+    # ## Presto Session properties along with HTTPS.
+    # # options='{"url": "presto://username:password@localhost:8443/tpch/default","connect_args":"{\"protocol\": \"https\", \"session_props\": {\"query_max_run_time\": \"1m\"}}"}'
+    # ## Presto Session properties when HTTPS is not enabled.
+    # # options='{"url": "presto://username:password@localhost:8080/tpch/default","connect_args":"{\"session_props\": {\"query_max_run_time\": \"1m\"}}"}' 
 
     # [[[clickhouse]]]
     #   name=ClickHouse

+ 6 - 0
desktop/conf/pseudo-distributed.ini.tmpl

@@ -1013,6 +1013,12 @@
     # # options='{"url": "presto://localhost:8080/hive/default", "has_impersonation": true}'
     # ## Kerberos.
     # # options='{"url": "presto://localhost:8080/hive/default?KerberosKeytabPath=/path/to/keytab&KerberosPrincipal=principal&KerberosRemoteServiceName=service&protocol=https"'
+    # ## LDAPS enabled over HTTPS.
+    # # options='{"url": "presto://username:password@localhost:8443/tpch/default","connect_args":"{\"protocol\": \"https\"}"}'
+    # ## Presto Session properties along with HTTPS.
+    # # options='{"url": "presto://username:password@localhost:8443/tpch/default","connect_args":"{\"protocol\": \"https\", \"session_props\": {\"query_max_run_time\": \"1m\"}}"}'
+    # ## Presto Session properties when HTTPS is not enabled.
+    # # options='{"url": "presto://username:password@localhost:8080/tpch/default","connect_args":"{\"session_props\": {\"query_max_run_time\": \"1m\"}}"}'
 
     # [[[clickhouse]]]
     #   name=ClickHouse

+ 7 - 0
desktop/libs/notebook/src/notebook/connectors/sql_alchemy.py

@@ -183,6 +183,13 @@ class SqlAlchemyApi(Api):
           self.options.pop('credentials_json')
       )
 
+    # enables various sql alchemy args to be passed along for both hive & presto connection. 
+    # Refer to sqlalchemy pyhive for more details 
+    if self.options.get('connect_args'):
+      self.options['connect_args'] = json.loads(
+          self.options.pop('connect_args')
+      )
+
     options = self.options.copy()
     options.pop('session', None)
     options.pop('url', None)

+ 12 - 0
docs/docs-site/content/administrator/configuration/connectors/_index.md

@@ -156,6 +156,18 @@ With credentials:
 
     options='{"url": "presto://username:password@localhost:8080/tpch/default"}'
 
+With LDAPS enabled over HTTPS:
+
+    options='{"url": "presto://username:password@localhost:8443/tpch/default","connect_args":"{\"protocol\": \"https\"}"}'
+
+Pass Presto Session properties along with HTTPS: 
+
+    options='{"url": "presto://username:password@localhost:8443/tpch/default","connect_args":"{\"protocol\": \"https\", \"session_props\": {\"query_max_run_time\": \"1m\"}}"}'
+
+Pass Presto Session Properties without HTTPS enabled:
+
+    options='{"url": "presto://username:password@localhost:8080/tpch/default","connect_args":"{\"session_props\": {\"query_max_run_time\": \"1m\"}}"}'
+
 Alternative interfaces.
 
 Direct: