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 all 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
76 changes: 76 additions & 0 deletions .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
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: Cache clj-kondo
uses: actions/cache@v2
with:
path: .clj-kondo/.cache
key: clj-kondo-cache
restore-keys: |
clj-kondo-cache

- name: Install dependencies
run: |
sudo apt install clojure leiningen -y

- name: Log versions
run: |
java --version
echo Clojure: $(clojure --eval "(clojure-version)")
echo Leiningen: $(lein --version)

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

- name: Run tests
run: lein test

- name: Run linter
run: |
mkdir -p .clj-kondo/.cache
lein lint

- 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
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/.clj-kondo/.cache/
/.cpcache/
/.lsp/
/target/
/.calva/
/maven_repository/
/.lein-failures
/.eastwood
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 allows you to query data from an Exasol database using Metabase.

# 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.
94 changes: 94 additions & 0 deletions doc/developer_guide/developer_guide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# Developer Guide

## Required Build Tools

For building and testing the driver you will need
* [Clojure](https://clojure.org/)
* [Leiningen](https://leiningen.org/)
kaklakariada marked this conversation as resolved.
Show resolved Hide resolved

To build Metabase itself you will need
* [Node.js](https://nodejs.org/en/)
* [Yarn](https://yarnpkg.com/)

On Unbuntu you can install the dependencies by running

```shell
sudo apt install nodejs yarnpkg clojure leiningen
```

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

```shell
clojure --eval "(clojure-version)"
```

## 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
```

<!-- markdown-link-check-disable-next-line -->
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 the latest Exasol JDBC driver for your operating system from the [Exasol download page](https://www.exasol.com/portal/display/DOWNLOAD/).
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`.
30 changes: 30 additions & 0 deletions project.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
(defproject metabase/exasol-driver "0.1.0"
: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"]
"clj-kondo-deps" ["clj-kondo" "--copy-configs" "--dependencies" "--lint" "$classpath" "--cache-dir" ".clj-kondo/.cache"]
"lint" ["do" ["clj-kondo-deps"] ["clj-kondo" "--lint" "src" "test" "--cache-dir" ".clj-kondo/.cache"]]
}

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

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

:user {:plugins [[com.github.clj-kondo/lein-clj-kondo "0.1.3"]]}

: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
Loading