starburstdata / metabase-driver

Starburst Metabase driver
Apache License 2.0
65 stars 10 forks source link
buisness-intelligence jdbc metabase starburst trino

Metabase Starburst Driver

Driver Plugin Installation

The Starburst Driver .jar binary can be downloaded from our releases in github. Once it is downloaded, it must be stored in the plugins directory within the Metabase working dir. See: https://www.metabase.com/docs/latest/developers-guide-drivers.html#how-to-use-a-third-party-driver

App Supported Versions

Please see supported versions for this release.

Developers Guide Drivers

Our build scripts will git clone the Metabase repo to ./metabase and copy all Starburst driver files into the expected folder: ./metabase/modules/drivers/starburst. From here, we leverage the Metabase build scripts to build our .jar file into the correct dir, run tests, and start the local server.

Prerequisites

Quick Start

Run make build test to build and run tests locally. If everything passes, you're good to go!

Building

Run make build to clone the Metabase repo and build all required components. This command should not need to be run again unless you manually git pull new changes into your local Metabase repo.

Force Updating Metabase Repo

You can manually run git commands to update the cloned Metabase repo, but if you want to remove the local Metabase repo and re-clone with the latest changes, make clean

Starting Local Server

Once you have built all required resources with the make build command, run make server. This command starts a local Metabase server on port 3000. If you want to build the driver and then start a server, run make driver server.

Testing Driver

Once you have built all required resources with the make build command, run make test. This command builds your local driver changes and then starts Starburst driver tests.

Staring a Trino Server in Docker

Running make test will start a Trino server for you on port 8082 when needed, but if you want to start one, you can run make start_trino_if_missing. Run make testOptimized to test Metabase with the "Optimized prepared statements" flag on.

Note: Running make test will populate the Trino catalogs with mock data that is used for testing. You can then connect Metabase to this Trino server to view that data. This is useful for manual testing.

Executing Specific Tests

You can cd into the metabase repo and run commands like: DRIVERS=starburst clojure -X:dev:drivers:drivers-dev:test :only metabase.query-processor-test.timezones-test/filter-test DRIVERS=starburst clojure -J-DexplicitPrepare=false -X:dev:drivers:drivers-dev:test :only metabase.query-processor-test.timezones-test/filter-test

or even

DRIVERS=starburst clojure -X:dev:drivers:drivers-dev:test :only metabase.query-processor-test.timezones-test

Releasing Driver

To create a release from the main branch follow the below steps.

1.) Create a Release Branch

Head to actions and run the Create Release Branch workflow entering in the correct semantic version, and submit the workflow. This will create a new PR that contains promoted CHANGELOG.md and updated version info. Review the PR and merge once checks pass.

2.) Create the Release Artifact

Head to actions and run the Release workflow entering the same the same semantic version, and submit the release workflow. When this workflow completes, it will create a new tagged github release with the provided version and upload the .jar binary for clients to consume.

Update Metabase Version

If needed, make checkout_latest_metabase_tag will update Metabase to its latest tagged release.

CAUTION: the Metabase test file metabase/test/metabase/driver_test.clj is overridden by a modified version on the root directory (see the Makefile). This is because two tests (can-connect-with-destroy-db-test and check-can-connect-before-sync-test) do not work with the Starburst driver as they're testing what happens when a database is deleted (which cannot happen with Starburst). So instead of adding some useless stuff to can-connect? for the sole purpose of satisfying tests, it was found preferable to just remove those two tests.

Whenever upgrading the version of Metabase, ./driver_test.clj should be replaced with metabase/test/metabase/driver_test.clj with the two offending tests removed (unless they pass or there is a clean way around them)

References

Contact

For feature requests and bugs, please create an issue in this repo. For further support, see the following resources: