From 68409dd8446b9e40bd644f522aafc37b84fb5546 Mon Sep 17 00:00:00 2001 From: Saugat Tripathi Date: Wed, 14 Aug 2019 16:05:29 -0700 Subject: [PATCH 1/2] Updated plugin to fulfill the best practices --- Presto/qubole_odbc/connection-dialog.tcd | 13 ++++------ Presto/qubole_odbc/connectionBuilder.js | 29 +++++++---------------- Presto/qubole_odbc/connectionResolver.tdr | 18 +++++++------- Presto/qubole_odbc/manifest.xml | 6 ++--- Presto/qubole_odbc/resources-en_US.xml | 7 ++++++ 5 files changed, 33 insertions(+), 40 deletions(-) create mode 100644 Presto/qubole_odbc/resources-en_US.xml diff --git a/Presto/qubole_odbc/connection-dialog.tcd b/Presto/qubole_odbc/connection-dialog.tcd index 923c823..e166245 100644 --- a/Presto/qubole_odbc/connection-dialog.tcd +++ b/Presto/qubole_odbc/connection-dialog.tcd @@ -1,15 +1,12 @@ - + - - - + - - - - + + diff --git a/Presto/qubole_odbc/connectionBuilder.js b/Presto/qubole_odbc/connectionBuilder.js index 8d88793..ec1d0c9 100644 --- a/Presto/qubole_odbc/connectionBuilder.js +++ b/Presto/qubole_odbc/connectionBuilder.js @@ -3,36 +3,23 @@ var params = {}; var server = attr[connectionHelper.attributeServer].split(';'); - // It is hard coded, there are other options to - // take care Hive, Spark. params["DSI"] = "presto" - // Database name in UI is mapped to Catalog in presto. - params["CATALOG"] = attr["dbname"]; - // Server is in UI is mapped to EndPoint. - // It could take any one of the values (us, in, api) - // Drop down would be best here. + params["CATALOG"] = attr[connectionHelper.attributeDatabase]; params["ENDPOINT"] = server[0]; - // Either can be treated as a password or bare string. - // Need to look into the aspects of security on reconnection. - // Service in UI is mapped to API. - params["APITOKEN"] = attr["service"]; - // Warehouse in UI is mapped to cluster label. - params["CLUSTER_LABEL"] = attr["warehouse"]; - //params["BUCKET_REGION"] = "ap-south-1"; + params["APITOKEN"] = attr[connectionHelper.attributePassword]; + params["CLUSTER_LABEL"] = attr[connectionHelper.attributeWarehouse]; params["BUCKET_REGION"] = server[1]; - // use_s3 feature enabled in odbc-2.0.0 params["USE_S3"] = "true"; - // Enabling PATH-STYLE-URLS(bucket name with `.` in it) - // when we have bucket region as input. - if (server.length == 2 && server[1] != "") { + if (server.length == 2 && server[1] != "") + { params["VIRTUAL_HOST_STYLE"] = "false"; }; var stream = attr["IsolationLevel"]; - if (stream == "ReadUncommitted") { - + if (stream == "ReadUncommitted") + { params["STREAM_RESULTS"] = "true"; }; @@ -44,6 +31,6 @@ { formattedParams.push(connectionHelper.formatKeyValuePair(key, params[key])); } - + return formattedParams; }) diff --git a/Presto/qubole_odbc/connectionResolver.tdr b/Presto/qubole_odbc/connectionResolver.tdr index 15cd431..e7f0f6b 100644 --- a/Presto/qubole_odbc/connectionResolver.tdr +++ b/Presto/qubole_odbc/connectionResolver.tdr @@ -6,14 +6,16 @@ - - class - server - dbname - service - warehouse - IsolationLevel - + + + server + dbname + warehouse + IsolationLevel + one-time-sql + authentication + password + diff --git a/Presto/qubole_odbc/manifest.xml b/Presto/qubole_odbc/manifest.xml index 6eba15e..3f9153a 100644 --- a/Presto/qubole_odbc/manifest.xml +++ b/Presto/qubole_odbc/manifest.xml @@ -1,9 +1,9 @@ - + - - + + diff --git a/Presto/qubole_odbc/resources-en_US.xml b/Presto/qubole_odbc/resources-en_US.xml new file mode 100644 index 0000000..ccfa85e --- /dev/null +++ b/Presto/qubole_odbc/resources-en_US.xml @@ -0,0 +1,7 @@ + + + Qubole Presto + Catalog: + End Point;Bucket Region: + Cluster Label: + From 5abb5afe6ef9c7e4070d7d6cd9a9acf01c3f4e7a Mon Sep 17 00:00:00 2001 From: Saugat Tripathi Date: Thu, 28 May 2020 13:55:52 -0700 Subject: [PATCH 2/2] Add qubole jdbc connector --- Presto/qubole_jdbc/connection-dialog.tcd | 13 ++++++++ Presto/qubole_jdbc/connectionBuilder.js | 10 ++++++ Presto/qubole_jdbc/connectionProperties.js | 19 ++++++++++++ Presto/qubole_jdbc/connectionResolver.tdr | 23 ++++++++++++++ Presto/qubole_jdbc/dialect.tdd | 23 ++++++++++++++ Presto/qubole_jdbc/manifest.xml | 36 ++++++++++++++++++++++ Presto/qubole_jdbc/resources-en_US.xml | 7 +++++ 7 files changed, 131 insertions(+) create mode 100644 Presto/qubole_jdbc/connection-dialog.tcd create mode 100644 Presto/qubole_jdbc/connectionBuilder.js create mode 100644 Presto/qubole_jdbc/connectionProperties.js create mode 100644 Presto/qubole_jdbc/connectionResolver.tdr create mode 100644 Presto/qubole_jdbc/dialect.tdd create mode 100644 Presto/qubole_jdbc/manifest.xml create mode 100644 Presto/qubole_jdbc/resources-en_US.xml diff --git a/Presto/qubole_jdbc/connection-dialog.tcd b/Presto/qubole_jdbc/connection-dialog.tcd new file mode 100644 index 0000000..079143b --- /dev/null +++ b/Presto/qubole_jdbc/connection-dialog.tcd @@ -0,0 +1,13 @@ + + + + + + + + + + + + diff --git a/Presto/qubole_jdbc/connectionBuilder.js b/Presto/qubole_jdbc/connectionBuilder.js new file mode 100644 index 0000000..e2cc419 --- /dev/null +++ b/Presto/qubole_jdbc/connectionBuilder.js @@ -0,0 +1,10 @@ +(function dsbuilder(attr) +{ + var urlBuilder = "jdbc:qubole://presto/" + attr[connectionHelper.attributeWarehouse] + "?"; + var server = attr[connectionHelper.attributeServer].split(";"); + for (var i=1; i + + + +