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

#1-project-setup #2

Merged
merged 22 commits into from
Dec 8, 2021
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
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
24 changes: 24 additions & 0 deletions .github/workflows/broken_links_checker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Broken Links Checker

on:
schedule:
- cron: "0 5 * * *"
push:
branches:
- main
pull_request:

jobs:
linkChecker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Configure broken links checker
run: |
mkdir -p ./target
echo '{ "aliveStatusCodes": [429, 200] }' > ./target/broken_links_checker.json
- uses: gaurav-nelson/github-action-markdown-link-check@v1
with:
use-quiet-mode: 'yes'
use-verbose-mode: 'yes'
config-file: ./target/broken_links_checker.json
65 changes: 65 additions & 0 deletions .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: CI Build

on:
push:
branches:
- main
pull_request:

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Set up JDK 11
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: 11

- name: Cache Maven repository
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('project.clj') }}
restore-keys: |
${{ runner.os }}-maven-

- name: Cache local Maven repository
uses: actions/cache@v2
with:
path: maven_repository
key: local-maven-${{ hashFiles('scripts/install-metabase-jar.sh') }}
restore-keys: |
local-maven-

- name: Install clojure tools
uses: DeLaGuardo/setup-clojure@3.5
kaklakariada marked this conversation as resolved.
Show resolved Hide resolved
with:
cli: latest
lein: latest

- name: Log versions
run: |
java --version
clojure --version
lein --version

- name: Install Metabase
run: ./scripts/install-metabase-jar.sh

- name: Run tests
run: lein test

- name: Build jar
run: DEBUG=1 lein uberjar

- name: Upload jar
kaklakariada marked this conversation as resolved.
Show resolved Hide resolved
uses: actions/upload-artifact@v2
with:
name: exasol.metabase-driver.jar
path: target/uberjar/exasol.metabase-driver.jar
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/.clj-kondo/.cache/
/.cpcache/
/.lsp/
/target/
/.calva/
/maven_repository/
/.lein-failures
5 changes: 5 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"recommendations": [
"betterthantomorrow.calva"
]
}
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Exasol Metabase Driver

An Exasol driver for [Metabase](https://www.metabase.com).

[![CI Build](https://github.com/exasol/metabase-driver/actions/workflows/ci-build.yml/badge.svg)](https://github.com/exasol/metabase-driver/actions/workflows/ci-build.yml)

# Overview

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

The Exasol Driver for Metabase is an adapter, that maps Exasol's analytical capabilities to Metabase's external interface, allowing Metabase to use Exasol-specific features.
kaklakariada marked this conversation as resolved.
Show resolved Hide resolved

# Table of Contents

## Information for Users

* [User Guide](doc/user_guide/user_guide.md)

## Information for Developers

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

# Dependencies

## Runtime Dependencies

To use the Exasol Driver, you need Metabase Version 0.41.2 or later.

Follow the [Metabase installation guide](https://www.metabase.com/docs/latest/operations-guide/installing-metabase.html) to download and install Metabase.
83 changes: 83 additions & 0 deletions doc/developer_guide/developer_guide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# Developer Guide

## Required Build Tools

* node.js, yarn
* clojure, Leiningen
kaklakariada marked this conversation as resolved.
Show resolved Hide resolved

You will need Clojure 1.10.3.905 or later. Run the following command to check your current version:

```shell
% clojure --version
Clojure CLI version 1.10.3.1020
```

## Setup Development Environment

1. Checkout Metabase at `$HOME/git/metabase` (= `$METABASE_DIR`) and build it:

```bash
cd $HOME/git
git clone https://github.com/metabase/metabase.git
cd metabase
# Build
./bin/build
# Run
clojure -M:run
```

2. Download the Exasol JDBC driver from the [Download Portal](https://www.exasol.com/portal/display/DOWNLOAD/) and install it:
kaklakariada marked this conversation as resolved.
Show resolved Hide resolved

```bash
cp exajdbc.jar "$METABASE_DIR/plugins"
```

3. Checkout the Exasol Metabase driver at `$HOME/git/metabase` (= `$METABASE_EXASOL_DRIVER`)

```bash
git clone https://github.com/exasol/metabase-driver.git
cd metabase-driver
```

## Run Driver Unit Tests

```bash
./scripts/install-metabase-jar.sh
lein test
```

## Start Metabase With the Exasol Driver

To start Metabase with the Exasol driver from source:

```bash
export METABASE_DIR="$HOME/git/metabase"
export METABASE_EXASOL_DRIVER="$HOME/git/metabase-driver"
cd $METABASE_DIR
clojure -Sdeps '{:deps {metabase/exasol-driver {:local/root "'"$METABASE_EXASOL_DRIVER"'"}}}' -J-Dmb.dev.additional.driver.manifest.paths=$METABASE_EXASOL_DRIVER/resources/metabase-plugin.yaml -M:run
```

After startup is complete (log message: `Metabase Initialization COMPLETE`) you can access Metabase at [http://localhost:3000/](http://localhost:3000/).

## Build and Install Exasol Driver

To start Metabase with the built Exasol driver:

```bash
export METABASE_DIR="$HOME/git/metabase"
export METABASE_EXASOL_DRIVER="$HOME/git/metabase-driver"
cd $METABASE_EXASOL_DRIVER

# Install dependencies
./scripts/install-metabase-jar.sh

# Build driver
DEBUG=1 lein uberjar

# Install driver
cp -v "$METABASE_EXASOL_DRIVER/target/uberjar/exasol.metabase-driver.jar" "$METABASE_DIR/plugins/"

# Run Metabase
cd $METABASE_DIR
clojure -M:run
```
Binary file added doc/user_guide/images/add_database.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/user_guide/images/add_exasol_database.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/user_guide/images/open_administration.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
43 changes: 43 additions & 0 deletions doc/user_guide/user_guide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# User Guide

To use the Exasol driver for Metabase please first follow the [Metabase installation guide](https://www.metabase.com/docs/latest/operations-guide/installing-metabase.html) to download and install Metabase.

We assume that you installed Metabase at `$METABASE_DIR`.

## Installing the Driver

1. Download and install the latest Exasol JDBC driver for your operating system from the [Exasol download page](https://www.exasol.com/portal/display/DOWNLOAD/).
kaklakariada marked this conversation as resolved.
Show resolved Hide resolved
2. Copy the Exasol JDBC driver `exajdbc.jar` to `$METABASE_DIR/plugins`.
3. Download the latest driver from the [GitHub release page](https://github.com/exasol/metabase-driver/releases).
4. Copy the driver `exasol.metabase-driver.jar` to `$METABASE_DIR/plugins`.
5. Restart Metabase.

## Connect to Exasol

After you have installed the driver, create a new connection to your Exasol database.

1. Start the Metabase administration
![Open Metabase administration](images/open_administration.png "Open Metabase administration")
2. Select the "Databases" section and click on "Add Database"
![Add Database](images/add_database.png "Add Database")
3. Select "Exasol" from the "Database type" drop down list and fill out the connection details:
* Name: Name of the database connection in Metabase
* Host: Hostname of your Exasol database
* Port: Port number of your Exasol database, default: `8563`
* Certificate Fingerprint: If your Exasol database uses a self-signed certificate, enter the certificate's checksum.
kaklakariada marked this conversation as resolved.
Show resolved Hide resolved
* Username: Name of the database user
* Password: Password of the database user
![Create Exasol Database](images/add_exasol_database.png "Create Exasol Database")
4. Click the "Save" button at the bottom of the page to verify and save the database connection.

## Troubleshooting

### Exasol Driver Not Available

If Database Type "Exasol" is not availabe in the "Add Database" dialog and Metabase logs the following message at startup, the Exasol JDBC driver is not available.

```
INFO plugins.dependencies :: Metabase cannot initialize plugin Metabase Exasol Driver due to required dependencies. Metabase requires the Exasol JDBC driver in order to connect to Exasol databases, but we can't ship it as part of the driver due to licensing restrictions. See https://github.com/exasol/metabase-driver for more details.
````

Please download the latest Exasol JDBC driver from the [Exasol download page](https://www.exasol.com/portal/display/DOWNLOAD/) and copy `exajdbc.jar` to `$METABASE_DIR/plugins`.
25 changes: 25 additions & 0 deletions project.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
(defproject metabase/exasol-driver "0.0.1"
kaklakariada marked this conversation as resolved.
Show resolved Hide resolved
:description "An Exasol driver for Metabase"
:url "https://github.com/exasol/metabase-driver/"
:min-lein-version "2.9.7"

:repositories {"Local Metabase" "file:maven_repository"}

:aliases
{"test" ["with-profile" "+unit_tests" "test"]}

:profiles
{:provided
{:dependencies [[org.clojure/clojure "1.10.0"]
[metabase "0.41.2"]]}

:unit_tests
{:test-paths ^:replace ["test_unit"]}

:uberjar
{:auto-clean true
:aot :all
:omit-source true
:javac-options ["-target" "1.8", "-source" "1.8"]
:target-path "target/%s"
:uberjar-name "exasol.metabase-driver.jar"}})
32 changes: 32 additions & 0 deletions resources/metabase-plugin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Complete list of options here: https://github.com/metabase/metabase/wiki/Metabase-Plugin-Manifest-Reference
info:
name: Metabase Exasol Driver
version: 0.1.0
description: Allows Metabase to connect to Exasol databases.
dependencies:
- class: com.exasol.jdbc.EXADriver
message: >
Metabase requires the Exasol JDBC driver in order to connect to Exasol databases, but we can't ship it as part
of the driver due to licensing restrictions. See
https://github.com/exasol/metabase-driver for more details.
driver:
name: exasol
display-name: Exasol
lazy-load: true
parent: sql-jdbc
# https://github.com/metabase/metabase/blob/master/src/metabase/driver/common.clj
connection-properties:
- host
- merge:
- port
- default: 8563
- name: certificate-fingerprint
display-name: Certificate Fingerprint
- user
- password
connection-properties-include-tunnel-config: false
init:
- step: load-namespace
namespace: metabase.driver.exasol
- step: register-jdbc-driver
class: com.exasol.jdbc.EXADriver
48 changes: 48 additions & 0 deletions scripts/install-metabase-jar.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/bin/bash
kaklakariada marked this conversation as resolved.
Show resolved Hide resolved

set -o errexit
set -o nounset
set -o pipefail

metabase_version="0.41.2"
metabase_sha256="d2303557342f3d88437d634fd38bd4b3657b7a31e5ad891e45b001801c121bf5"

metabase_download_url="https://downloads.metabase.com/v$metabase_version/metabase.jar"

exasol_driver_dir="$( cd "$(dirname "$0")/.." >/dev/null 2>&1 ; pwd -P )"
local_maven_repo="$exasol_driver_dir/maven_repository"

if [ ! -d "$local_maven_repo" ]; then
mkdir -p "$local_maven_repo"
fi

if [ -d "$local_maven_repo/metabase/metabase/$metabase_version" ]; then
echo "Metabase $metabase_version already installed in $local_maven_repo"
exit 0
fi

echo "Metabase $metabase_version not yet installed in $local_maven_repo"

temp_file="$local_maven_repo/metabase_$metabase_version.jar"

if [ -f "$temp_file" ]; then
echo "Metabase $metabase_version already downloaded to $temp_file"
else
echo "Downloading Metabase $metabase_version to $temp_file..."
curl "$metabase_download_url" --output "$temp_file"
fi

echo "Verifying checksum..."

if ! echo "$metabase_sha256 $temp_file" | shasum --strict --check --algorithm 256 ; then
shasum_output=($(shasum --algorithm 256 "$temp_file"))
actual_sha256=${shasum_output[0]}
echo "Checksum verification failed for $temp_file. Expected $metabase_sha256 but was $actual_sha256"
exit 1
fi

mvn deploy:deploy-file -Dfile="$temp_file" -Durl="file:$local_maven_repo" \
-DgroupId=metabase -DartifactId=metabase -Dversion="$metabase_version" -Dpackaging=jar \
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn

rm -f "$temp_file"
Loading