forked from opensearch-project/sql
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from Bit-Quill/migrate-jdbc-tableau-connector
Added Tableau Connector to OpenSearch SQL
- Loading branch information
Showing
8 changed files
with
509 additions
and
0 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
sql-jdbc/src/TableauConnector/opensearch_sql_jdbc/META-INF/MANIFEST.MF
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Manifest-Version: 1.0 | ||
Created-By: 13 (Oracle Corporation) | ||
|
44 changes: 44 additions & 0 deletions
44
sql-jdbc/src/TableauConnector/opensearch_sql_jdbc/connection-fields.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
6 changes: 6 additions & 0 deletions
6
sql-jdbc/src/TableauConnector/opensearch_sql_jdbc/connection-metadata.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
28 changes: 28 additions & 0 deletions
28
sql-jdbc/src/TableauConnector/opensearch_sql_jdbc/connectionBuilder.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]; | ||
}) |
26 changes: 26 additions & 0 deletions
26
sql-jdbc/src/TableauConnector/opensearch_sql_jdbc/connectionResolver.tdr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
Oops, something went wrong.