Skip to content

Commit

Permalink
#75: Upgrade to Metabase v.0.48.0 (#76)
Browse files Browse the repository at this point in the history
Co-authored-by: Christoph Kuhnke <github@kuhnke.net>
  • Loading branch information
kaklakariada and ckunki authored Dec 15, 2023
1 parent fe94511 commit ddaa8be
Show file tree
Hide file tree
Showing 14 changed files with 198 additions and 139 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
cancel-in-progress: true
runs-on: ubuntu-latest
env:
METABASE_TAG: v0.47.3
METABASE_TAG: v0.48.0
steps:
- name: Checkout the repository
uses: actions/checkout@v4
Expand All @@ -32,7 +32,7 @@ jobs:
ref: ${{ env.METABASE_TAG }}

- name: Set up JDK 11
uses: actions/setup-java@v2
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 11
Expand Down Expand Up @@ -69,7 +69,7 @@ jobs:
run: "$GITHUB_WORKSPACE/metabase-driver/scripts/build.sh"

- name: Upload jar
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: exasol.metabase-driver.jar
path: metabase-driver/target/exasol.metabase-driver.jar
Expand Down
12 changes: 9 additions & 3 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
pull_request:

jobs:
integration-test:
matrix-integration-test:
strategy:
fail-fast: true
matrix:
Expand All @@ -18,7 +18,7 @@ jobs:
name: "Build with Exasol ${{ matrix.exasol_version }}"
runs-on: ubuntu-latest
env:
METABASE_TAG: v0.47.3
METABASE_TAG: v0.48.0
steps:
- name: Free Disk Space
run: |
Expand Down Expand Up @@ -47,7 +47,7 @@ jobs:
path: 'integration-test-docker-environment'

- name: Set up JDK 11
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 11
Expand Down Expand Up @@ -100,3 +100,9 @@ jobs:
EXASOL_PORT=$ITDE_DATABASE_DB_PORT \
EXASOL_USER=sys EXASOL_PASSWORD=exasol \
$GITHUB_WORKSPACE/metabase-driver/scripts/run-integration-tests.sh
integration-test:
needs: matrix-integration-test
runs-on: ubuntu-latest
steps:
- run: echo "Build successful"
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
build:
runs-on: ubuntu-latest
env:
METABASE_TAG: v0.47.3
METABASE_TAG: v0.48.0
steps:
- name: Checkout the repository
uses: actions/checkout@v4
Expand All @@ -28,7 +28,7 @@ jobs:
ref: ${{ env.METABASE_TAG }}

- name: Set up JDK 11
uses: actions/setup-java@v2
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 11
Expand Down
4 changes: 2 additions & 2 deletions deps.edn
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
:aliases
{:dev
{:extra-deps
{io.github.metabase/metabase {:git/tag "v0.47.3" :git/sha "0ca7df3"}}}
{io.github.metabase/metabase {:git/tag "v0.48.0" :git/sha "0ca7df3"}}}

; clojure -M:clj-kondo --lint src test --debug
:clj-kondo
{:replace-deps {clj-kondo/clj-kondo {:mvn/version "2023.03.17"}}
{:replace-deps {clj-kondo/clj-kondo {:mvn/version "2023.10.20"}}
:main-opts ["-m" "clj-kondo.main"]}}}
1 change: 1 addition & 0 deletions doc/changes/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Changes

* [1.0.7](changes_1.0.7.md)
* [1.0.6](changes_1.0.6.md)
* [1.0.5](changes_1.0.5.md)
* [1.0.4](changes_1.0.4.md)
Expand Down
11 changes: 11 additions & 0 deletions doc/changes/changes_1.0.7.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# metabase-driver 1.0.7, released 2023-12-15

Code name: Upgrade to Metabase v0.48.0

## Summary

This release adapts the driver to Metabase v0.48.0.

## Features

* #75: Upgraded to Metabase v0.48.0
75 changes: 53 additions & 22 deletions doc/developer_guide/developer_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,27 @@ To build Metabase itself you will need

On Ubuntu you can install the dependencies by running

```shell
```sh
sudo apt install nodejs yarnpkg
```

Fedora:

```shell
```sh
yum install perl-Digest-SHA nodejs yarnpkg
```

On macOS you additionally need `gnu-sed`:

```shell
```sh
brew install nodejs yarnpkg clojure gnu-sed
# Then add gnubin to your PATH:
# export PATH="/usr/local/opt/gnu-sed/libexec/gnubin:$PATH"
```

Run the following commands to check the current versions:

```shell
```sh
clojure -M --eval "(clojure-version)"
clojure --version
```
Expand All @@ -40,45 +40,66 @@ clojure --version

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

```bash
```sh
cd $HOME/git
git clone https://github.com/metabase/metabase.git
cd metabase
git fetch --all --tags
export METABASE_VERSION=v0.47.3
export METABASE_VERSION=v0.48.0
git reset --hard
rm -vf target/patch_excluded_test_applied
git checkout "tags/${METABASE_VERSION}" -b "${METABASE_VERSION}-branch"
# Build (this will take ~15min)
./bin/build.sh
# Run
clojure -M:run
```

2. Download the Exasol JDBC driver from the [Download Portal](https://downloads.exasol.com/clients-and-drivers) and install it:

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

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

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

## Run Driver Unit Tests
## Upgrading Metabase

```bash
To ensure compatibility we need to regularly update to the latest Metabase version. You can find the latest Metabase version on the [GitHub release page](https://github.com/metabase/metabase/releases/).

Metabase publishes two variants:
* OSS: version numbers v0.x.y
* Enterprise: version numbers v1.x.y

We only use the OSS variant with version numbers v0.x.y.

To upgrade Metabase follow these steps:
1. Check the Metabase [driver changelog](https://www.metabase.com/docs/latest/developers-guide/driver-changelog.html) for breaking changes
2. Replace the previous version in all files with the new version by searching for `v0.x.y`
3. [Run unit tests](#running-driver-unit-tests)
4. [Run integration tests](#running-integration-tests)

The following things can go wrong:
* The patch excluding inapproriate tests cannot be applied. See [excluded tests](#excluded-tests) for details.
* Tests fail or abort
* If possible fix the problem in the driver
* If failures are related to Exasol specifics (e.g. missing `TIME` data type etc.) modify the test in Metabase and update the patch file, see [excluded tests](#excluded-tests) for details.
* If failures are unrelated to Exasol or the driver, you might delete it and update the patch file, see [excluded tests](#excluded-tests) for details.

## Running Driver Unit Tests

```sh
./scripts/run-unit-tests.sh
```

## Start Metabase With the Exasol Driver

To start Metabase with the Exasol driver from source:

```bash
```sh
export METABASE_DIR="$HOME/git/metabase"
export METABASE_EXASOL_DRIVER="$HOME/git/metabase-driver"
cd $METABASE_DIR
Expand All @@ -92,7 +113,7 @@ After startup is complete (log message: `Metabase Initialization COMPLETE`) you

To start Metabase with the built Exasol driver:

```bash
```sh
export METABASE_DIR="$HOME/git/metabase"
export METABASE_EXASOL_DRIVER="$HOME/git/metabase-driver"
cd $METABASE_EXASOL_DRIVER
Expand All @@ -108,34 +129,34 @@ cd $METABASE_DIR
clojure -M:run
```

## Running the Integration Tests
## Running Integration Tests

You need to have metabase checked out next to this repository.

Start Exasol docker container:

```shell
```sh
docker run --publish 8563:8563 --publish 2580:2580 --publish 443:443 --detach --privileged --stop-timeout 120 exasol/docker-db:7.1.23
```

Start integration tests:

```shell
```sh
EXASOL_HOST=<hostname> EXASOL_PORT=8563 EXASOL_USER=sys EXASOL_PASSWORD=exasol ./scripts/run-integration-tests.sh
```

This script builds and installs the driver before running the integration tests. The driver must be installed to `$METABASE_DIR/plugins/` for running the integration tests.

To run only a single tests or only tests in a namespace add arguments:

```shell
```sh
./scripts/run-integration-tests.sh :only name.space/single-test
./scripts/run-integration-tests.sh :only name.space
```

### Using the REPL

```shell
```sh
export MB_EXASOL_TEST_HOST=<hostname>
export MB_EXASOL_TEST_PORT=8563
export MB_EXASOL_TEST_USER=sys
Expand Down Expand Up @@ -173,7 +194,7 @@ In the REPL you can use the following commands:

To increase the log level for integration tests, edit file `$METABASE_DIR/test_config/log4j2-test.xml`.

### Unsupported Datasets / Excluded Tests
### Excluded Tests

Exasol does not support the `TIME` data type. That is why we can't load the following datasets from the Metabase integration tests:
Expand All @@ -186,14 +207,24 @@ Script `run-integration-tests.sh` automatically applies this patch when file `$M
When the patch file has changed or you updated to a new Metabase release, do the following and re-run the integration tests with `run-integration-tests.sh`.
```shell
```sh
cd $METABASE_DIR
git reset --hard && rm -vf target/patch_excluded_test_applied
```
#### Applying Patch Fails
If applying the patch fails after upgrading to a new Metabase version, follow these steps:
1. Run `cd $METABASE_DIR && git reset --hard && rm -vf target/patch_excluded_test_applied`
2. Remove the failed part from `exclude_tests.diff`
3. Run integration tests `run-integration-tests.sh`. This will apply the patch.
4. Modify Metabase tests to adapt them to Exasol
5. Update patch by running `cd $METABASE_DIR && git diff > $METABASE_EXASOL_DRIVER/scripts/exclude_tests.diff`
## Linting
```shell
```sh
clojure -M:clj-kondo --lint src test --debug
```
Expand Down
2 changes: 1 addition & 1 deletion resources/metabase-plugin.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Complete list of options here: https://github.com/metabase/metabase/wiki/Metabase-Plugin-Manifest-Reference
info:
name: Metabase Exasol Driver
version: 1.0.6
version: 1.0.7
description: Allows Metabase to connect to Exasol databases.
contact-info:
name: Exasol AG
Expand Down
Loading

0 comments on commit ddaa8be

Please sign in to comment.