Skip to content

Commit

Permalink
Merge pull request #1 from Bit-Quill/migrate-jdbc-tableau-connector
Browse files Browse the repository at this point in the history
Added Tableau Connector to OpenSearch SQL
  • Loading branch information
guiangumpac authored Nov 18, 2021
2 parents 603d953 + 040552f commit c8ddfb9
Show file tree
Hide file tree
Showing 8 changed files with 509 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Manifest-Version: 1.0
Created-By: 13 (Oracle Corporation)

Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<connection-fields>
<field name="authentication" label="Authentication" category="authentication" value-type="selection" default-value="auth-user-pass">
<selection-group>
<option value="auth-none" label="No authentication"/>
<option value="auth-user-pass" label="Username and Password"/>
<option value="auth-integrated" label="AWS_SIGV4"/>
</selection-group>
</field>
<field name="server" label="Server" value-type="string" category="endpoint" default-value="localhost">
</field>
<field name="port" label="Port" value-type="string" category="endpoint" default-value="9200">
</field>
<field name="username" label="Username" category="authentication" value-type="string">
<conditions>
<condition field="authentication" value="auth-user-pass"/>
</conditions>
</field>
<field name="password" label="Password" category="authentication" value-type="string" secure="true">
<conditions>
<condition field="authentication" value="auth-user-pass"/>
</conditions>
</field>
<field name="v-region" label="Region" category="authentication" value-type="string" optional="true">
<conditions>
<condition field="authentication" value="auth-integrated"/>
</conditions>
</field>
<field name="sslmode" label="Use SSL" value-type="boolean" category="general" default-value="require">
<boolean-options>
<false-value value=""/>
<true-value value="require"/>
</boolean-options>
</field>
<field name="v-trustSelfSigned" label="Trust Self-Signed Certificate" value-type="boolean" category="general" default-value="false">
<conditions>
<condition field="authentication" value="auth-user-pass"/>
<condition field="authentication" value="auth-none"/>
</conditions>
<boolean-options>
<false-value value="false"/>
<true-value value="true"/>
</boolean-options>
</field>
</connection-fields>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<connection-metadata>
<database enabled='false' />
<schema enabled='false' />
<table enabled='true' label="Table" />
</connection-metadata>
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
(function dsbuilder(attr){
var connStr = "jdbc:opensearch://";
// Set SSL value in connection string
if (attr[connectionHelper.attributeSSLMode] == "require"){
connStr += "https://";
} else {
connStr += "http://";
}

// Set host information in connection string
connStr += attr[connectionHelper.attributeServer] + ":" + attr[connectionHelper.attributePort] + "?";

// Set authentication values in connection string
var authAttrValue = attr[connectionHelper.attributeAuthentication];
if (authAttrValue == "auth-none"){
connStr += "auth=NONE&trustSelfSigned=" + attr["v-trustSelfSigned"];
} else if (authAttrValue == "auth-integrated"){
connStr += "auth=AWS_SIGV4";
var region = attr["v-region"];
if (region){
connStr += "&Region=" + region;
}
} else { //if (authAttrValue == "auth-user-pass"){
connStr += "auth=BASIC&user=" + attr[connectionHelper.attributeUsername] + "&password=" + attr[connectionHelper.attributePassword] + "&trustSelfSigned=" + attr["v-trustSelfSigned"];
}

return [connStr];
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version='1.0' encoding='utf-8' ?>
<tdr class='opensearch_jdbc'>
<connection-resolver>
<connection-builder>
<script file='connectionBuilder.js'/>
</connection-builder>
<connection-normalizer>
<required-attributes>
<default-attributes>
<default-attribute name='server'>localhost</default-attribute>
<default-attribute name='port'>9200</default-attribute>
</default-attributes>
<attribute-list>
<attr>server</attr>
<attr>port</attr>
<attr>authentication</attr>
<attr>username</attr>
<attr>password</attr>
<attr>sslmode</attr>
<attr>v-region</attr>
<attr>v-trustSelfSigned</attr>
</attribute-list>
</required-attributes>
</connection-normalizer>
</connection-resolver>
</tdr>
Loading

0 comments on commit c8ddfb9

Please sign in to comment.