Git Product home page Git Product logo

metabase-clickhouse-driver's Introduction

ClickHouse driver for Metabase


About

ClickHouse (GitHub) database driver for the Metabase (GitHub) business intelligence front-end.

Installation

Run using Metabase Jar

  1. Download a fairly recent Metabase binary release (jar file) from the Metabase distribution page.
  2. Download the ClickHouse driver jar from this repository's Releases page
  3. Create a directory and copy the metabase.jar to it.
  4. In that directory create a sub-directory called plugins.
  5. Copy the ClickHouse driver jar to the plugins directory.
  6. Make sure you are the in the directory where your metabase.jar lives.
  7. Run MB_PLUGINS_DIR=./plugins; java -jar metabase.jar.

For example (using Metabase v0.49.3 and ClickHouse driver 1.4.0):

export METABASE_VERSION=v0.49.3
export METABASE_CLICKHOUSE_DRIVER_VERSION=1.4.0

mkdir -p mb/plugins && cd mb
curl -o metabase.jar https://downloads.metabase.com/$METABASE_VERSION/metabase.jar
curl -L -o plugins/ch.jar https://github.com/ClickHouse/metabase-clickhouse-driver/releases/download/$METABASE_CLICKHOUSE_DRIVER_VERSION/clickhouse.metabase-driver.jar
MB_PLUGINS_DIR=./plugins; java -jar metabase.jar

Run as a Docker container

Alternatively, if you don't want to run Metabase Jar, you can use a Docker image:

export METABASE_DOCKER_VERSION=v0.49.3
export METABASE_CLICKHOUSE_DRIVER_VERSION=1.4.0

mkdir -p mb/plugins && cd mb
curl -L -o plugins/ch.jar https://github.com/ClickHouse/metabase-clickhouse-driver/releases/download/$METABASE_CLICKHOUSE_DRIVER_VERSION/clickhouse.metabase-driver.jar
docker run -d -p 3000:3000 \
  --mount type=bind,source=$PWD/plugins/ch.jar,destination=/plugins/clickhouse.jar \
  metabase/metabase:$METABASE_DOCKER_VERSION

Choosing the Right Version

Metabase Release Driver Version
0.33.x 0.6
0.34.x 0.7.0
0.35.x 0.7.1
0.37.3 0.7.3
0.38.1+ 0.7.5
0.41.2 0.8.0
0.41.3.1 0.8.1
0.42.x 0.8.1
0.44.x 0.9.1
0.45.x 1.1.0
0.46.x 1.1.7
0.47.x 1.2.3
0.47.7+ 1.2.5
0.48.x 1.3.4
0.49.x 1.4.0

Creating a Metabase Docker image with ClickHouse driver

You can use a convenience script build_docker_image.sh, which takes three arguments: Metabase version, ClickHouse driver version, and the desired final Docker image tag.

./build_docker_image.sh v0.49.3 1.4.0 my-metabase-with-clickhouse:v0.0.1

where v0.49.3 is Metabase version, 1.4.0 is ClickHouse driver version, and my-metabase-with-clickhouse:v0.0.1 being the tag.

Then you should be able to run it:

docker run -d -p 3000:3000 --name my-metabase my-metabase-with-clickhouse:v0.0.1

or use it with Docker compose, for example:

version: '3.8'
services:
  clickhouse:
    image: 'clickhouse/clickhouse-server:24.3-alpine'
    container_name: 'metabase-clickhouse-server'
    ports:
      - '8123:8123'
      - '9000:9000'
    ulimits:
      nofile:
        soft: 262144
        hard: 262144
  metabase:
    image: 'my-metabase-with-clickhouse:v0.0.1'
    container_name: 'metabase-with-clickhouse'
    environment:
      'MB_HTTP_TIMEOUT': '5000'
      # Replace with a timezone matching your ClickHouse or DateTime columns timezone
      'JAVA_TIMEZONE': 'UTC'
    ports:
      - '3000:3000'

Using certificates

In the "Advanced options", add the following to the "Additional JDBC connection string options" input:

sslrootcert=/path/to/ca.crt

where /path/to/ca.crt is the absolute path to the server CA on the Metabase host or Docker container (depends on your deployment).

Make sure that you tick "Use a secure connection (SSL)" as well.

Operations

The driver should work fine for many use cases. Please consider the following items when running a Metabase instance with this driver:

  • Create a dedicated user for Metabase, whose profile has readonly set to 2.
  • Consider running the Metabase instance in the same time zone as your ClickHouse database; the more time zones involved the more issues.
  • Compare the results of the queries with the results returned by clickhouse-client.
  • Metabase is a good tool for organizing questions, dashboards etc. and to give non-technical users a good way to explore the data and share their results. The driver cannot support all the cool special features of ClickHouse, e.g. array functions. You are free to use native queries, of course.

Known limitations

  • As the underlying JDBC driver version does not support columns with AggregateFunction type, these columns are excluded from the table metadata and data browser result sets to prevent sync or data browsing errors.
  • If the past month/week/quarter/year filter over a DateTime64 column is not working as intended, this is likely due to a type conversion issue. See this report for more details. This issue was resolved as of ClickHouse 23.5.
  • If introspected ClickHouse version is lower than 23.8, the driver will not use startsWithUTF8 and fall back to its non-UTF8 counterpart instead. There is a drawback in this compatibility mode: potentially incorrect filtering results when working with non-latin strings. If your use case includes filtering by columns with such strings and you experience these issues, consider upgrading your ClickHouse server to 23.8+.

Contributing

Check out our contributing guide.

metabase-clickhouse-driver's People

Contributors

slvrtrn avatar enqueue avatar mshustov avatar nellicus avatar calherries avatar qoega avatar lucas-tubi avatar veschin avatar s-huk avatar aquarius-wing avatar zhicwu avatar metamben avatar

Forkers

slvrtrn

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.