Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/22-switch-to-jdbc-driver #23

Merged
merged 63 commits into from
Oct 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
5fef2c5
Update name of ODBC driver
kaklakariada Oct 1, 2021
4d5f4b0
Update ODBC manifest
kaklakariada Oct 1, 2021
3f08dc0
Add JDBC connector
kaklakariada Oct 1, 2021
2a77ab7
Update user guide
kaklakariada Oct 4, 2021
f2a96bd
Add JDBC capabilities
kaklakariada Oct 4, 2021
61da07f
Describe installation of jdbc driver
kaklakariada Oct 5, 2021
8005259
Adapt capabilities for jdbc driver
kaklakariada Oct 5, 2021
d18e9b4
Adapt to Exasol
kaklakariada Oct 5, 2021
aa3f58a
Add fingerprint
kaklakariada Oct 5, 2021
007584c
Configure tdvt
kaklakariada Oct 5, 2021
62693d0
Add data source tests
kaklakariada Oct 5, 2021
888ddc8
Add results workbook
kaklakariada Oct 6, 2021
93e86f6
Update data source
kaklakariada Oct 6, 2021
5468ffa
Update test result workbook
kaklakariada Oct 6, 2021
66743d6
Configure string trim for jdbc
kaklakariada Oct 6, 2021
55b6ef5
Add test with bad password
kaklakariada Oct 6, 2021
0d8a196
Skip string.split test: function not supported by Exasol
kaklakariada Oct 6, 2021
6df6dc1
Rename column zzz2 to zzz
kaklakariada Oct 6, 2021
3bd6385
Remove trailing spaces when extracting parts of a date
kaklakariada Oct 6, 2021
f91f9db
Remove duplicate space
kaklakariada Oct 6, 2021
a4b871c
Add rationale for skipping the 'split' function tests
kaklakariada Oct 6, 2021
d99ab28
Change test user name to be equal to odbc tests
kaklakariada Oct 7, 2021
94b2e8f
Skip test for time data type
kaklakariada Oct 7, 2021
7824508
Rename tdvt folder to odbc
kaklakariada Oct 7, 2021
a46dd8c
Adapt hostname for jdbc tests
kaklakariada Oct 7, 2021
4893e9c
Adapt odbc tests to run
kaklakariada Oct 7, 2021
b69604c
Unify test configuration for jdbc & odbc
kaklakariada Oct 7, 2021
816e211
Fix odbc issues with spaces
kaklakariada Oct 7, 2021
31ac6e6
Configure max number of threads to 1
kaklakariada Oct 7, 2021
d33dbc5
Remvove argument for number of threads
kaklakariada Oct 8, 2021
13a131f
Add comment about failing tests
kaklakariada Oct 8, 2021
e841deb
Ignore Eclipse config files
kaklakariada Oct 18, 2021
f612ec7
Update instructions for building the dockerfile
kaklakariada Oct 18, 2021
7c0d9b1
Update dependencies
kaklakariada Oct 18, 2021
76cd272
Improve formatting of readme
kaklakariada Oct 18, 2021
11b75e9
Add HtmlUnit driver
kaklakariada Oct 18, 2021
d8b810a
Use Exasol 7.1.1, improve error handling
kaklakariada Oct 18, 2021
18b5fad
Improve error handling in shell script
kaklakariada Oct 18, 2021
9bb3934
Cleanup
kaklakariada Oct 18, 2021
d76fd7c
Adapt configuration to Eclipse 2021-09
kaklakariada Oct 18, 2021
41e960b
Validate & package jdbc connector
kaklakariada Oct 18, 2021
87165cd
Merge branch 'feature/22-switch-to-jdbc-driver' of https://github.com…
kaklakariada Oct 18, 2021
f7a9a80
Improve pom setup
kaklakariada Oct 20, 2021
9049e72
Cleanup tests: remove unused ports
kaklakariada Oct 20, 2021
5949a72
Read properties file in Java code to avoid having to set environment
kaklakariada Oct 20, 2021
b6f746e
Upgrade testcontainers to fix uploading files to the container
kaklakariada Oct 20, 2021
3675255
Adapt UI-Tests to new Connector name / Tableau version
kaklakariada Oct 20, 2021
5e447c8
Run tests in headless mode
kaklakariada Oct 20, 2021
a5d4996
Document ui-test setup
kaklakariada Oct 20, 2021
7a824a7
Build JDBC url with fingerprint and certificate validation arguments
kaklakariada Oct 20, 2021
0279193
Update fingerprint in connection files
kaklakariada Oct 20, 2021
d54a0d1
Add developer guide
kaklakariada Oct 20, 2021
8f089ad
Move test instructions to developer guide
kaklakariada Oct 20, 2021
16c24aa
Add connection dialog screenshot
kaklakariada Oct 20, 2021
5bcd40b
Configure Eclipse formatter to never join already wrapped lines
kaklakariada Oct 21, 2021
d17af39
Extract base class for JDBC & ODBC connector tests
kaklakariada Oct 21, 2021
7212df1
Add UI tests for JDBC connector
kaklakariada Oct 21, 2021
ac3afbe
Fix failing StaplesDataTest
kaklakariada Oct 22, 2021
45de930
Add changelog, improve documentation
kaklakariada Oct 22, 2021
b2078c0
#22 Implement review findings by @AnastasiiaSergienko
kaklakariada Oct 22, 2021
666f431
Apply suggestions from code review
kaklakariada Oct 27, 2021
4cd944a
Implement review findings by @AnastasiiaSergienko
kaklakariada Oct 27, 2021
559a0a8
Merge branch 'feature/22-switch-to-jdbc-driver' of https://github.com…
kaklakariada Oct 27, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
**/tdvt_results_workbook.twbx
.idea
*.iml
*.env
*.env
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

# Overview

[Tableau](https://www.tableau.com/) is a business intelligence tool. You can use Tableau to visualize data in [Exasol](https://www.exasol.com).
[Tableau](https://www.tableau.com/) is a business intelligence tool. You can use Tableau to visualize data in [Exasol](https://www.exasol.com).

The Exasol Tableau Connector is an adapter, that maps Exasol's analytical capabilities to Tableau's external interface, allowing Tableau to use Exasol-specific features.

Expand All @@ -13,6 +13,7 @@ The Exasol Tableau Connector is an adapter, that maps Exasol's analytical capabi
* Exasol-specific connection dialog
* Maps Tableau functions to Exasol functions


# Table of Contents

## Information for Users
Expand All @@ -21,11 +22,15 @@ The Exasol Tableau Connector is an adapter, that maps Exasol's analytical capabi
* [Tableau in the Exasol Online Documentation](https://docs.exasol.com/connect_exasol/bi_tools/tableau.htm)
* [White paper on Exasol and Tableau](https://www.exasol.com/resource/tableau-exasol-better-together/)

## Information for Developers

* [Developer Guide](doc/developer_guide/developer_guide.md)

# Dependencies

## Runtime Dependencies

To use the Exasol Tableau Connector, you need Tableau Version 2020.3 or later either as desktop or server variant.
To use the Exasol Tableau Connector, you need Tableau Version 2021.3 or later either as desktop or server variant.

## Test Dependencies

Expand Down
1 change: 1 addition & 0 deletions doc/changes/changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Changes

* [0.2.0](changes_0.2.0.md)
* [0.1.0](changes_0.1.0.md)
13 changes: 13 additions & 0 deletions doc/changes/changes_0.2.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Exasol Tableau Connector 0.2.0, released 2021-10-??

Code name: JDBC Connector

## Summary

Version 0.2.0 of the Tableau Connector adds a JDBC connector that offers an option for certificate validation and allows entering a certificate fingerprint.

The new release also fixes an issue with the ODBC connector that caused all strings being trimmed by removing capabilities `CAP_ODBC_TRIM_NO_EMPTY_STRING` and `CAP_ODBC_TRIM_VARCHAR_PADDING`. We also fixed some failing TDVT tests for the ODBC connector and improved the documentation for developers.

## Features

* #22: Add JDBC connector
186 changes: 186 additions & 0 deletions doc/developer_guide/developer_guide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
# Developer Guide

This developer guide describes how to

* Test the connectors manually
* Run Tableau's TDVT test suite
* Run UI tests for Tableau Server

## Manually Testing Connectors

To manually test the connectors in Tableau Desktop without packaging, add the following arguments when starting Tableau Desktop:

```bat
"C:\Program Files\Tableau\Tableau 2021.3\bin\tableau.exe" -DConnectPluginsPath=%USERPROFILE%\git\tableau-connector\src -DLogLevel=Debug
kaklakariada marked this conversation as resolved.
Show resolved Hide resolved
```

* `-DConnectPluginsPath=path\to\tableau-connector\src`: Path to the `src` directory of this cloned repository.
* `-DLogLevel=Debug`: enable log output of `logging.Log()` in JavaScript files.

After starting Tableau Desktop, click `More...` in the left bar under "To a Server", then click `Exasol JDBC by Exasol AG` or `Exasol ODBC by Exasol AG` to open the database connection dialog for JDBC resp. ODBC.

Restart Tableau after modifying any connector file to reload changes.

## Packaging the Connectors

This requires `python3-venv` to be installed.

To package the JDBC and ODBC connectors, execute

```sh
cd tableau-server-GUI-tests
./set_up_scripts/package_connector.sh
```

This validates the connectors and creates the connectors at

```
tableau-server-GUI-tests/target/exasol_jdbc.taco
tableau-server-GUI-tests/target/exasol_odbc.taco
```

To use the connectors, copy them to `C:\Program Files\Tableau\Connectors`.

As the connectors are not signed, you need to start Tableau Desktop with argument `-DDisableVerifyConnectorPluginSignature`.

## Running TDVT Tests

You can run TDVT tests under Windows and macOS. This guide describes the setup for Windows. The setup for macOS is similar.

### Initial Setup

* Create a new Exasol database running on port `8563`.
* Prepare database schema by running [tools/load_tvdt_test_data.sql](../../tools/load_tvdt_test_data.sql).
* Configure hostname of the Exasol database: Add an entry to `c:\Windows\System32\Drivers\etc\hosts`. Adapt the IP to your database:

```
10.0.0.2 exasol.test.lan
```

* Install TDVT as described in the [TDVT documentation](https://tableau.github.io/connector-plugin-sdk/docs/tdvt#set-up).
* Update the Exasol certificate fingerprint in the four `*.tds` files:
* [tdvt_jdbc/tds/cast_calcs.exasol_jdbc.tds](../../tdvt_jdbc/tds/cast_calcs.exasol_jdbc.tds)
* [tdvt_jdbc/tds/Staples.exasol_jdbc.tds](../../tdvt_jdbc/tds/Staples.exasol_jdbc.tds)
* [tdvt_odbc/tds/Staples.exasol_odbc.tds](../../tdvt_odbc/tds/Staples.exasol_odbc.tds)
* [tdvt_odbc/tds/cast_calcs.exasol_odbc.tds](../../tdvt_odbc/tds/cast_calcs.exasol_odbc.tds)

* Update the path to `tabquerytool.exe` (e.g. `C:\Program Files\Tableau\Tableau 2021.3\bin\tabquerytool.exe`) in
* [tdvt_jdbc/config/tdvt/tdvt_override.ini](../../tdvt_jdbc/config/tdvt/tdvt_override.ini)
* [tdvt_odbc/config/tdvt/tdvt_override.ini](../../tdvt_odbc/config/tdvt/tdvt_override.ini)

### Configure Test Suites

You can configure the tests suites to run in files
* [tdvt_jdbc/config/exasol_jdbc.ini](../../tdvt_jdbc/config/exasol_jdbc.ini)
* [tdvt_odbc/config/exasol_odbc.ini](../../tdvt_odbc/config/exasol_odbc.ini)

After modifying these files you need to re-generate the test suite by adding the `--generate` argument to the `tdvt.tdvt run` command.

See the [manual](https://tableau.github.io/connector-plugin-sdk/docs/tdvt#ini-file-structure) for details about the available tests.

### Run Tests

* JDBC Connector:

```bash
cd tdvt_jdbc
python -m tdvt.tdvt run exasol_jdbc --generate
python -m tdvt.tdvt run exasol_jdbc
```

* ODBC Connector:

```bash
cd tdvt_odbc
python -m tdvt.tdvt run exasol_odbc --generate
python -m tdvt.tdvt run exasol_odbc
```

See the [manual](https://tableau.github.io/connector-plugin-sdk/docs/tdvt#about-running-tdvt) for details.

### Viewing Test Results

TDVT writes the test result to `test_results_combined.csv`. You can view it by opening the `TDVT Results.twb` workbook with Tableau Desktop. After re-running the tests type `F5` to refresh the results. See [detailed instructions](https://tableau.github.io/connector-plugin-sdk/docs/tdvt#review-results).

### Troubleshooting

Log files of Tableau Desktop: `%USERPROFILE%\Documents\My Tableau Repository\Logs\`:
* `log.txt`
* `jprotocolserver.log`

Also see the [FAQ and troubleshooting section of the manual](https://tableau.github.io/connector-plugin-sdk/docs/tdvt#frequently-found-issues-and-troubleshooting).

## Tableau Server UI Tests

### Setup

1. Follow the [instructions](https://help.tableau.com/current/server-linux/en-us/server-in-container_setup-tool.htm) to create a container. This should result in an image `tableau_server_image:<version>`, e.g. `tableau_server_image:20213.21.0917.1006`.
2. Update `tableau-server-GUI-tests/set_up_scripts/Dockerfile`:
* Use the same image created before in the `FROM` line, e.g. `tableau_server_image:20213.21.0917.1006`.
* Update the download urls to the latest Exasol release if available.
3. Update constant `DEFAULT_DOCKER_DB_REFERENCE` in class `TableauServerGUITestIT` to the latest Exasol release.
4. Build a new container including the Exasol ODBC and JDBC drivers by running

```bash
cd tableau-server-GUI-tests/set_up_scripts
docker build . --tag tablau_server_with_exasol_drivers
```

### Run the Tests

To run the tests you need to create the `tableau-server-GUI-tests/src/test/resources/credentials.properties` file with the following content (replace the placeholders for real values):

```properties
TABLEAU_USERNAME=<tableau-server-username>
TABLEAU_PASSWORD=<tableau-server-password>
TABLEAU_LICENSE_KEY=<tableau-server-license-key>
```

Start the tests with

```sh
cd tableau-server-GUI-tests
mvn integration-test
```

### Run the Tests Remotely

Startup of the Tableau Server takes a long time. We recommend using an AWS instance running "Amazon Linux 2" with 16 CPUs, e.g. `c5a.4xlarge`. With this instance type, startup will take about 15 to 20 minutes instead of 30 minutes.

You can either run the tests completely on the remote machine or start them on your local machine.

#### Start tests on remote machine

This assumes you are using an AWS instance running Amazon Linux 2.

1. Setup the instance with a UI as described [here](https://aws.amazon.com/premiumsupport/knowledge-center/ec2-linux-2-install-gui/).
2. Install a Chrome browser as this will be used for running the UI tests.
3. Install Java 11 (`yum install java-11-amazon-corretto`) and the latest Maven version.
4. Start the VNC server on the instance with `vncserver -geometry 1920x1080`.
5. Tunnel the VNC server port via `ssh <host> -L 5901:localhost:5901`.
6. Start a local VNC client and connect to `localhost:5901`.
7. In the VNC session make sure you can start the `chrome` browser.
8. Run the tests via `mvn integration-test`.

#### Start tests on local machine

If you want to trigger the tests from your local IDE, you need to forward the required ports and configure your local environment:

```sh
ssh ec2-user@<remote machine address> -i <ssh-key> -L 2375:localhost:2375 -L 33445:localhost:33445 -L 33446:localhost:33446
```

Specify the host where the docker daemon is running and disable the Ryuk container:

```sh
export DOCKER_HOST=tcp://localhost:2375
export TESTCONTAINERS_RYUK_DISABLED=true
```

### Troubleshooting

#### Tableau Server Container Startup Fails

When the Tableau server container stops after some minutes, you can start the container with environment variable `TSM_ONLY=1`, attach to the container and start the server with `"${DOCKER_CONFIG}"/config/tsm-commands`. See [detailed instructions](https://help.tableau.com/current/server-linux/en-gb/server-in-container_troubleshoot.htm).

One possible root cause is an invalid license key. To check if the license is valid, run `tsm licenses list` in the container. You can try to get a trial license by running `tsm licenses activate --trial`.
Binary file added doc/images/jdbc_connection_dialog.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 17 additions & 4 deletions doc/user_guide/user_guide.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,24 @@
# User Guide

The Exasol Tableau Connector is distributed together with Tableau Desktop and Tableau Server applications. We recommend using the latest available version of Tableau products to access the connector.

![JDBC connection dialog](../images/jdbc_connection_dialog.png "JDBC connection dialog")

If you want to use the currently developed version of connector, you can follow the guide below and install the connector disabling sign verification.

## Testing In-Development Connector

## With Tableau Desktop
### Install the JDBC Driver

* [Download the JDBC driver](https://www.exasol.com/portal/display/DOWNLOAD/)
* Copy the driver to the Tableau installation directory:
* Windows: `C:\Program Files\Tableau\Drivers`
* Mac: `~/Library/Tableau/Drivers`
* Linux: `/opt/tableau/tableau_driver/jdbc`

**Important note for Windows:** Make sure to download and install file `EXASOL_JDBC-<version>.msi`. The JDBC driver will be installed to `C:\Program Files\Exasol\EXASolution-7.1\JDBC\exajdbc.jar`. Only the JDBC driver for Windows supports Kerberos under Windows.

### With Tableau Desktop

* Clone the Tableau-Connector repository. You can execute the following command from [Git Bash](https://gitforwindows.org/) terminal:

Expand All @@ -16,16 +29,16 @@ If you want to use the currently developed version of connector, you can follow
* Open Windows cmd and start Tableau Desktop providing the path to the connector directory and also disabling the signature check.

```shell
"<path to tableau.exe file>" -DConnectPluginsPath=<path to connector> -DDisableVerifyConnectorPluginSignature
"<path to tableau.exe file>" -DConnectPluginsPath=<path to connector>
```

Example:

```shell
"C:\Program Files\Tableau\Tableau <version>\bin\tableau.exe" -DConnectPluginsPath=C:\Users\user\git\tableau-connector\src -DDisableVerifyConnectorPluginSignature
"C:\Program Files\Tableau\Tableau <version>\bin\tableau.exe" -DConnectPluginsPath=C:\Users\user\git\tableau-connector\src
```

## With Tableau Server
### With Tableau Server

* Clone the Tableau-Connector repository:

Expand Down
27 changes: 27 additions & 0 deletions src/exasol_jdbc/connectionBuilder.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
(function dsbuilder(attr) {

const authentication = attr[connectionHelper.attributeAuthentication];
const fingerprint = attr["v-fingerprint"];
const validateServerCertificate = attr["v-validateservercertificate"];

logging.Log("connectionBuilder.js: input args: authentication='" + authentication
+ "', fingerprint='" + fingerprint
+ "', validateServerCertificate='"+ validateServerCertificate+"'");

var fingerprintArg = "";
if(fingerprint && fingerprint.trim().length > 0) {
fingerprintArg = "/" + fingerprint.trim();
}

// See https://docs.exasol.com/connect_exasol/drivers/jdbc.htm
const url = "jdbc:exa:"
+ attr[connectionHelper.attributeServer]
+ fingerprintArg
+ ":"
+ attr[connectionHelper.attributePort]
+ ";validateservercertificate=" + validateServerCertificate
+ ";feedbackinterval=1"
+ ";clientname=TableauDesktop";

return [url];
})
22 changes: 22 additions & 0 deletions src/exasol_jdbc/connectionFields.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>

<connection-fields>
<field name="server" label="Server" value-type="string" optional="false" category="endpoint" />

<field name="port" label="Port" value-type="string" optional="false" category="endpoint" default-value="8563" />

<field name="authentication" label="Authentication" category="authentication" value-type="string" editable="false" default-value="auth-user-pass" />

<field name="username" label="Username" value-type="string" optional="false" category="authentication" />

<field name="password" label="Password" value-type="string" optional="false" category="authentication" secure="true" />

<field name="v-fingerprint" label="Server Certificate Fingerprint" value-type="string" optional="true" category="general" />

<field name="v-validateservercertificate" label="Validate Server Certificate" value-type="boolean" optional="false" category="general" default-value="1">
<boolean-options>
<false-value value="0" />
<true-value value="1" />
</boolean-options>
</field>
</connection-fields>
9 changes: 9 additions & 0 deletions src/exasol_jdbc/connectionMetadata.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>

<connection-metadata>
<database enabled='true' label='Database'>
<field optional='true' default-value='' />
</database>
<schema enabled='true' label="Schema" />
<table enabled='true' label="Table" />
</connection-metadata>
7 changes: 7 additions & 0 deletions src/exasol_jdbc/connectionProperties.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
(function propertiesbuilder(attr) {
logging.Log("Running connectionProperties.js")
var props = {};
props["user"] = attr[connectionHelper.attributeUsername];
props["password"] = attr[connectionHelper.attributePassword];
return props;
})
27 changes: 27 additions & 0 deletions src/exasol_jdbc/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='exasol_jdbc'>
<connection-resolver>
<connection-builder>
<script file='connectionBuilder.js'/>
</connection-builder>
<connection-normalizer>
<required-attributes>
<setImpersonateAttributes/>
<attribute-list>
<attr>server</attr>
<attr>port</attr>
<attr>dbname</attr>
<attr>schema</attr>
<attr>authentication</attr>
<attr>username</attr>
<attr>password</attr>
<attr>v-fingerprint</attr>
<attr>v-validateservercertificate</attr>
</attribute-list>
</required-attributes>
</connection-normalizer>
<connection-properties>
<script file='connectionProperties.js'/>
</connection-properties>
</connection-resolver>
</tdr>
Loading