Skip to content
This repository has been archived by the owner on Mar 31, 2021. It is now read-only.

Commit

Permalink
Add Tableau connector source files (#82)
Browse files Browse the repository at this point in the history
* Login with basic auth

* Add auth none

*AWS auth addition
  • Loading branch information
rupal-bq authored May 11, 2020
1 parent 4f3fe7b commit 54768bc
Show file tree
Hide file tree
Showing 7 changed files with 138 additions and 7 deletions.
10 changes: 5 additions & 5 deletions src/IntegrationTests/ITODBCAwsAuth/test_odbc_aws_auth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,21 @@ std::wstring dsn_name = L"test_aws_auth_dsn";
std::wstring aws_auth_conn_string =
L"Driver={Elasticsearch};DataBase=database_name;"
L"Host=https://"
L"search-sept-cdg-david-test-domain-gouok3seqeupz64smuvfxyddui.eu-west-3."
L"search-bit-quill-cx3hpfoxvasohujxkllmgjwqde.us-west-2."
L"es.amazonaws.com;"
L"Auth=AWS_SIGV4;Region=eu-west-3;LogLevel=1";
L"Auth=AWS_SIGV4;Region=us-west-2;LogLevel=1";
std::wstring aws_auth_conn_string_invalid_region =
L"Driver={Elasticsearch};DataBase=database_name;"
L"Host=https://"
L"search-sept-cdg-david-test-domain-gouok3seqeupz64smuvfxyddui.eu-west-3."
L"search-bit-quill-cx3hpfoxvasohujxkllmgjwqde.us-west-2."
L"es.amazonaws.com;"
L"Auth=AWS_SIGV4;Region=us-west-3;LogLevel=1";
std::wstring aws_auth_conn_string_invalid_authtype =
L"Driver={Elasticsearch};DataBase=database_name;"
L"Host=https://"
L"search-sept-cdg-david-test-domain-gouok3seqeupz64smuvfxyddui.eu-west-3."
L"search-bit-quill-cx3hpfoxvasohujxkllmgjwqde.us-west-2."
L"es.amazonaws.com;"
L"Auth=AWS;Region=eu-west-3;LogLevel=1";
L"Auth=AWS;Region=us-west-2;LogLevel=1";

class TestAwsAuthConnection : public testing::Test {
public:
Expand Down
14 changes: 14 additions & 0 deletions src/TableauConnector/connection-dialog.tcd
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<connection-dialog class='odfe_sql_odbc'>
<connection-config>
<authentication-mode value='ComboBoxIntegrated' />
<authentication-options>
<option name="None" value="NONE" default="true" />
<option name="Integrated" value="AWS_SIGV4" />
<option name="UsernameAndPassword" value="BASIC" />
</authentication-options>
<port-prompt value="Port: " default="9200" />
<show-ssl-checkbox value="true" />
<vendor1-prompt value="Region: " />
<vendor2-prompt value="Additional Options: " />
</connection-config>
</connection-dialog>
42 changes: 42 additions & 0 deletions src/TableauConnector/connectionBuilder.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
(function dsbuilder(attr){
var params = {};

// Set host information in connection string
params["SERVER"] = attr[connectionHelper.attributeServer];
params["PORT"] = attr[connectionHelper.attributePort];

// Set authentication values in connection string
var authAttrValue = attr[connectionHelper.attributeAuthentication];
params["Auth"] = attr[connectionHelper.attributeAuthentication];
if (authAttrValue == "AWS_SIGV4"){
params["Region"] = attr[connectionHelper.attributeVendor1];
} else if (authAttrValue == "BASIC"){
params["UID"] = attr[connectionHelper.attributeUsername];
params["PWD"] = attr[connectionHelper.attributePassword];
}

// Set SSL value in connection string
if (attr[connectionHelper.attributeSSLMode] == "require"){
params["useSSL"] = "1";
} else {
params["useSSL"] = "0";
}

// Parse additional options and add in connection string
var odbcConnectStringExtrasMap = {};
const attributeODBCConnectStringExtras = "vendor2";
if (attributeODBCConnectStringExtras in attr){
odbcConnectStringExtrasMap = connectionHelper.ParseODBCConnectString(attr[attributeODBCConnectStringExtras]);
}
for (var key in odbcConnectStringExtrasMap){
params[key] = odbcConnectStringExtrasMap[key];
}

// Format the attributes as 'key=value'
var formattedParams = [];
formattedParams.push(connectionHelper.formatKeyValuePair(driverLocator.keywordDriver, driverLocator.locateDriver(attr)));
for (var key in params){
formattedParams.push(connectionHelper.formatKeyValuePair(key, params[key]));
}
return formattedParams;
})
27 changes: 27 additions & 0 deletions src/TableauConnector/connectionResolver.tdr
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version='1.0' encoding='utf-8' ?>
<tdr class='odfe_sql_odbc'>
<connection-resolver>
<connection-builder>
<script file='connectionBuilder.js'/>
</connection-builder>
<connection-normalizer>
<required-attributes>
<attribute-list>
<attr>server</attr>
<attr>port</attr>
<attr>authentication</attr>
<attr>username</attr>
<attr>password</attr>
<attr>sslmode</attr>
<attr>vendor1</attr>
<attr>vendor2</attr>
</attribute-list>
</required-attributes>
</connection-normalizer>
</connection-resolver>
<driver-resolver>
<driver-match >
<driver-name type='regex'>ODFE SQL ODBC*</driver-name>
</driver-match>
</driver-resolver>
</tdr>
7 changes: 7 additions & 0 deletions src/TableauConnector/dialect.tdd
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<dialect name='OdfeSqlOdbcDialect'
class='odfe_sql_odbc'
base='MySQL41UnicodeDriverDialect'
version='18.1'>
</dialect>

41 changes: 41 additions & 0 deletions src/TableauConnector/manifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?xml version='1.0' encoding='utf-8' ?>

<connector-plugin class='odfe_sql_odbc' superclass='odbc' plugin-version='0.2.0' name='ODFE SQL ODBC' version='18.1' min-version-tableau='2019.4'>
<vendor-information>
<company name="Amazon"/>
<support-link url="https://github.com/opendistro-for-elasticsearch/sql-odbc"/>
<driver-download-link url="https://github.com/opendistro-for-elasticsearch/sql-odbc"/>
</vendor-information>
<connection-customization class="odfe_sql_odbc" enabled="true" version="10.0">
<vendor name="Amazon"/>
<driver name="ODFE SQL ODBC Driver"/>
<customizations>
<customization name="CAP_CREATE_TEMP_TABLES" value="no"/>
<customization name="CAP_SUPPRESS_DISCOVERY_QUERIES" value="yes" />
<customization name="CAP_SELECT_INTO" value="no"/>
<customization name="CAP_SELECT_TOP_INTO" value="no"/>
<customization name="CAP_QUERY_BOOLEXPR_TO_INTEXPR" value="no"/>
<customization name="CAP_QUERY_GROUP_BY_BOOL" value="yes"/>
<customization name="CAP_QUERY_GROUP_BY_DEGREE" value="yes"/>
<customization name="CAP_QUERY_SORT_BY" value="yes"/>
<customization name="CAP_QUERY_SUBQUERIES" value="yes"/>
<customization name="CAP_QUERY_TOP_N" value="yes"/>
<customization name="CAP_QUERY_TOP_SAMPLE" value="yes"/>
<customization name="CAP_QUERY_TOP_SAMPLE_PERCENT" value="yes"/>
<customization name="CAP_QUERY_WHERE_FALSE_METADATA" value="yes"/>
<customization name="CAP_QUERY_SUBQUERIES_WITH_TOP" value="yes"/>
<customization name="CAP_SUPPORTS_SPLIT_FROM_LEFT" value="yes"/>
<customization name="CAP_SUPPORTS_SPLIT_FROM_RIGHT" value="yes"/>
<customization name="CAP_QUERY_ALLOW_PARTIAL_AGGREGATION" value="no"/>
<customization name="CAP_QUERY_TIME_REQUIRES_CAST" value="yes"/>
<customization name="CAP_ODBC_METADATA_FORCE_NUM_PREC_RADIX_10" value="yes"/>
<customization name="CAP_ODBC_METADATA_FORCE_LENGTH_AS_PRECISION" value="yes"/>
<customization name="CAP_ODBC_SUPPRESS_INFO_SCHEMA_TABLES" value="yes"/>
<customization name="CAP_ODBC_SUPPRESS_PG_TEMP_SCHEMA_TABLES" value="yes"/>
<customization name="CAP_ODBC_METADATA_SUPPRESS_SQLSTATISTICS_API" value="yes"/>
</customizations>
</connection-customization>
<connection-dialog file='connection-dialog.tcd'/>
<connection-resolver file="connectionResolver.tdr"/>
<dialect file='dialect.tdd'/>
</connector-plugin>
4 changes: 2 additions & 2 deletions src/UnitTests/UTAwsSdkCpp/test_aws_sdk_cpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ using namespace Aws::Http;

static const char service_name[] = "es";
static const char allocation_tag[] = "AWS_SIGV4_Test";
static const char host[] = "https://search-sept-cdg-david-test-domain-gouok3seqeupz64smuvfxyddui.eu-west-3.es.amazonaws.com";
static const char region[] = "eu-west-3";
static const char host[] = "https://search-bit-quill-cx3hpfoxvasohujxkllmgjwqde.us-west-2.es.amazonaws.com";
static const char region[] = "us-west-2";

TEST(AWS_SIGV4, EnvironmentAWSCredentials) {
Aws::SDKOptions options;
Expand Down

0 comments on commit 54768bc

Please sign in to comment.