Skip to content

Commit

Permalink
Migrate to tools.dep (#36)
Browse files Browse the repository at this point in the history
* Migrate to tools.dep

* Cleanup developer guide

* Remove code to get driver version

This will be fixed in #40

* Install driver for running integration tests

This avoids error

java.lang.IllegalArgumentException: No method in multimethod 'connection-properties' for dispatch value: :exasol

* Build frontend to fix failing integration tests

 ERROR in metabase.pulse.render.js-svg-test/combo-test (js_engine.clj:38)
[PRO TIP] If this test fails, you may need to rebuild the bundle with `yarn build-static-viz`

Uncaught exception, not in assertion.

clojure.lang.ExceptionInfo: Javascript resource not found: frontend_client/app/dist/lib-static-viz.bundle.js
    source: "frontend_client/app/dist/lib-static-viz.bundle.js"

* Upgrade to Metabase 0.43.1

* Remove features not supported in the latest release of metabase

* Activate linting with clj kondo
  • Loading branch information
kaklakariada authored May 24, 2022
1 parent db7b7fc commit daf3259
Show file tree
Hide file tree
Showing 15 changed files with 165 additions and 242 deletions.
55 changes: 29 additions & 26 deletions .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,40 +14,42 @@ jobs:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
runs-on: ubuntu-latest
env:
METABASE_TAG: v0.43.1
steps:
- name: Checkout the repository
uses: actions/checkout@v3
with:
fetch-depth: 0
path: metabase-driver

- name: Checkout the Metabase repository
uses: actions/checkout@v3
with:
fetch-depth: 1
repository: metabase/metabase
path: metabase
ref: ${{ env.METABASE_TAG }}

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

- name: Install clojure tools
uses: DeLaGuardo/setup-clojure@3.6
uses: DeLaGuardo/setup-clojure@5.1
with:
cli: latest
lein: latest

- name: Cache Maven repository
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('project.clj', 'scripts/install-metabase-jar.sh') }}
key: ${{ runner.os }}-maven-${{ hashFiles('metabase-driver/deps.edn', 'metabase/**/deps.edn') }}
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:
Expand All @@ -61,24 +63,25 @@ jobs:
java --version
echo Clojure: $(clojure -M --eval "(clojure-version)")
clojure --version
echo Leiningen: $(lein --version)
- name: Install Metabase
run: ./scripts/install-metabase-jar.sh
- name: Build driver
run: |
cd "$GITHUB_WORKSPACE/metabase-driver"
clojure -X:build :project-dir "\"$(pwd)\""
- name: Upload jar
uses: actions/upload-artifact@v3
with:
name: exasol.metabase-driver.jar
path: metabase-driver/target/exasol.metabase-driver.jar
if-no-files-found: error

- name: Run tests
run: lein test
- name: Run unit tests
run: "$GITHUB_WORKSPACE/metabase-driver/scripts/run-unit-tests.sh"

- name: Run linter
run: |
cd "$GITHUB_WORKSPACE/metabase-driver"
mkdir -p .clj-kondo/.cache
lein lint
clojure -M:clj-kondo --lint src test --debug
- name: Build jar
run: DEBUG=1 lein uberjar

- name: Upload jar
uses: actions/upload-artifact@v2
with:
name: exasol.metabase-driver.jar
path: target/uberjar/exasol.metabase-driver.jar
24 changes: 7 additions & 17 deletions .github/workflows/integration-tests.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.43.0
METABASE_TAG: v0.43.1
steps:
- name: Checkout the repository
uses: actions/checkout@v3
Expand All @@ -39,35 +39,26 @@ jobs:
path: 'integration-test-docker-environment'

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

- name: Install clojure tools
uses: DeLaGuardo/setup-clojure@3.6
uses: DeLaGuardo/setup-clojure@5.1
with:
cli: latest
lein: latest

- name: Cache Maven repository
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('metabase-driver/project.clj', 'metabase-driver/scripts/run-integration-tests.sh', 'metabase-driver/scripts/install-metabase-jar.sh') }}
key: ${{ runner.os }}-maven-${{ hashFiles('metabase-driver/deps.edn', 'metabase/**/deps.edn') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Cache local Maven repository
uses: actions/cache@v2
with:
path: maven_repository
key: local-maven-${{ hashFiles('metabase-driver/scripts/install-metabase-jar.sh') }}
restore-keys: |
local-maven-
- name: Cache node modules
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
Expand All @@ -79,7 +70,6 @@ jobs:
java --version
echo Clojure: $(clojure -M --eval "(clojure-version)")
clojure --version
echo Leiningen: $(lein --version)
- name: Build Metabase static viz
run: |
Expand All @@ -94,7 +84,7 @@ jobs:
- name: Run integration tests
run: |
source $GITHUB_WORKSPACE/integration-test-docker-environment/.build_output/cache/environments/test/environment_info.sh
EXASOL_HOST=$ENVIRONMENT_DATABASE_HOST \
EXASOL_HOST=$ENVIRONMENT_DATABASE_HOST \
EXASOL_PORT=$ENVIRONMENT_DATABASE_DB_PORT \
EXASOL_USER=sys EXASOL_PASSWORD=exasol \
$GITHUB_WORKSPACE/metabase-driver/scripts/run-integration-tests.sh
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@
/target/
/.calva/
/maven_repository/
/.lein-failures
/.eastwood
/.nrepl-port
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ The Exasol Driver for Metabase is an adapter, that allows you to query data from

## Runtime Dependencies

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

Follow the [Metabase installation guide](https://www.metabase.com/docs/latest/operations-guide/installing-metabase.html) to download and install Metabase.
29 changes: 29 additions & 0 deletions deps.edn
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{:paths
["src" "resources"]

:mvn/repos
{"Exasol" {:url "https://maven.exasol.com/artifactory/exasol-releases"}}

:deps
{com.exasol/exasol-jdbc {:mvn/version "7.1.10"}}

;; Build the driver with clojure -X:build
:aliases
{:build
{:extra-deps {metabase/metabase-core {:local/root "../metabase"}
metabase/build-drivers {:local/root "../metabase/bin/build-drivers"}}
:exec-fn build-drivers.build-driver/build-driver!
:exec-args {:driver :exasol
:project-dir "."
:target-dir "./target"}}

; clojure -M:clj-kondo --lint src test --debug
:clj-kondo
{:replace-deps {clj-kondo/clj-kondo {:mvn/version "2022.04.25"}}
:main-opts ["-m" "clj-kondo.main"]}}

:oss
;; JDBC driver isn't GPL-compatible
{:replace-deps {}}
:ee
{}}
5 changes: 3 additions & 2 deletions doc/changes/changes_1.0.1.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# metabase-driver 1.0.1, released 2022-05-??

Code name: Adapt to Metabase 0.43.0
Code name: Adapt to Metabase 0.43.1

## Summary

In this release we adapted the driver to Metabase version 0.43.0. This release was only tested with Metabase 0.43.0. If you use an older version of Metabase please use metabase-driver 1.0.0.
In this release we adapted the driver to Metabase version 0.43.1 and migrated the build system to deps.edn. This release was only tested with Metabase 0.43.1. If you use an older version of Metabase please use metabase-driver 1.0.0.

## Features

* #38: Adapted driver to Metabase version 0.43.0
* #35: Migrated build system to deps.edn and adapted driver to Metabase version 0.43.1
26 changes: 12 additions & 14 deletions doc/developer_guide/developer_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

For building and testing the driver you will need
* [Clojure](https://clojure.org/) version 1.10.3 or later
* [Leiningen](https://leiningen.org/) version 2.9.8 or later

To build Metabase itself you will need
* [Node.js](https://nodejs.org/en/)
Expand All @@ -25,7 +24,7 @@ yum install perl-Digest-SHA nodejs yarnpkg
On macOS you additionally need `gnu-sed`:

```shell
brew install nodejs yarnpkg clojure leiningen gnu-sed
brew install nodejs yarnpkg clojure gnu-sed
# Then add gnubin to your PATH:
# export PATH="/usr/local/opt/gnu-sed/libexec/gnubin:$PATH"
```
Expand All @@ -35,19 +34,18 @@ Run the following commands to check the current versions:
```shell
clojure -M --eval "(clojure-version)"
clojure --version
lein --version
```

## Setup Development Environment

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

```bash
export METABASE_VERSION=0.43.0
cd $HOME/git
git clone https://github.com/metabase/metabase.git
cd metabase
git fetch --all --tags
export METABASE_VERSION=0.43.1
git checkout "tags/v${METABASE_VERSION}" -b "v${METABASE_VERSION}-branch"
# Build (this will take ~15min)
./bin/build
Expand All @@ -71,8 +69,7 @@ lein --version
## Run Driver Unit Tests

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

## Start Metabase With the Exasol Driver
Expand All @@ -98,14 +95,11 @@ 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
clojure -X:build :project-dir "\"$(pwd)\""
# Install driver
cp -v "$METABASE_EXASOL_DRIVER/target/uberjar/exasol.metabase-driver.jar" "$METABASE_DIR/plugins/"
cp -v "$METABASE_EXASOL_DRIVER/target/exasol.metabase-driver.jar" "$METABASE_DIR/plugins/"
# Run Metabase
cd $METABASE_DIR
Expand Down Expand Up @@ -157,7 +151,7 @@ In the REPL you can use the following commands:
(dev/query-jdbc-db [:exasol 'test-data] "SELECT * from CAM_179.\"test_data_users\"")
```

### Helfpul Files in Metabase
### Helpful Files in Metabase

* [deps.edn](https://github.com/metabase/metabase/blob/master/deps.edn): Dependencies and comments with useful commands for building and testing
* [`dev/src/dev.clj`](https://github.com/metabase/metabase/blob/master/dev/src/dev.clj): Functions for developing with the REPL
Expand All @@ -184,8 +178,12 @@ When the patch file has changed or you updated to a new Metabase release, do the
```shell
cd $METABASE_DIR
git reset --hard
rm -vf target/patch_excluded_test_applied
git reset --hard && rm -vf target/patch_excluded_test_applied
```
## Linting
```shell
clojure -M:clj-kondo --lint src test --debug
```
# Troubleshooting
Expand Down
32 changes: 0 additions & 32 deletions project.clj

This file was deleted.

6 changes: 3 additions & 3 deletions scripts/exclude_tests.diff
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
diff --git a/test/metabase/api/table_test.clj b/test/metabase/api/table_test.clj
index 7bd2ea7362..d77500e812 100644
index 495be5d570..36620d487e 100644
--- a/test/metabase/api/table_test.clj
+++ b/test/metabase/api/table_test.clj
@@ -720,7 +720,7 @@
@@ -737,7 +737,7 @@
(dimension-options-for-field response "timestamp"))))))

(testing "time columns"
- (mt/test-drivers (mt/normal-drivers-except #{:sparksql :mongo :oracle :redshift})
+ (mt/test-drivers (mt/normal-drivers-except #{:sparksql :mongo :oracle :redshift :exasol}) ; Exasol does not support TIME data type
+ (mt/test-drivers (mt/normal-drivers-except #{:sparksql :mongo :oracle :exasol}) ; Exasol does not support TIME data type
(mt/dataset test-data-with-time
(let [response (mt/user-http-request :rasta :get 200 (format "table/%d/query_metadata" (mt/id :users)))]
(is (= @#'table-api/time-dimension-indexes
Expand Down
Loading

0 comments on commit daf3259

Please sign in to comment.