ClickHouse / metabase-clickhouse-driver

ClickHouse database driver for the Metabase business intelligence front-end
Apache License 2.0
474 stars 91 forks source link

No method in multimethod 'connection-details->spec' for dispatch value: :clickhouse #43

Closed MLikeWater closed 4 years ago

MLikeWater commented 4 years ago

Clickhouse and metabase version

Clickhouse: 19.17.2.4 Metabase: v0.34.0 (Latest) metabase-clickhouse-driver: 0.6

Deployment

I copy the driver jar clickhouse.metabase-driver.jar to the plugins directory, as follows:

# ll plugins/
total 117740
-rw-r--r-- 1 root root   392466 Dec 23 17:39 bigquery.metabase-driver.jar
-rw-r--r-- 1 root root  3875030 Dec 23 18:26 clickhouse.metabase-driver.jar
-rw-r--r-- 1 root root   465476 Dec 23 17:39 druid.metabase-driver.jar
-rw-r--r-- 1 root root   617794 Dec 23 17:39 googleanalytics.metabase-driver.jar
-rw-r--r-- 1 root root  3055790 Dec 23 17:39 google.metabase-driver.jar
-rw-r--r-- 1 root root  6550563 Dec 23 17:39 mongo.metabase-driver.jar
-rw-r--r-- 1 root root    68018 Dec 23 17:39 oracle.metabase-driver.jar
-rw-r--r-- 1 root root   140859 Dec 23 17:39 presto.metabase-driver.jar
-rw-r--r-- 1 root root  2381192 Dec 23 17:39 redshift.metabase-driver.jar
-rw-r--r-- 1 root root 30587032 Dec 23 17:39 snowflake.metabase-driver.jar
-rw-r--r-- 1 root root 63997026 Dec 23 17:39 sparksql.metabase-driver.jar
-rw-r--r-- 1 root root  7114948 Dec 23 17:39 sqlite.metabase-driver.jar
-rw-r--r-- 1 root root  1229843 Dec 23 17:39 sqlserver.metabase-driver.jar
-rw-r--r-- 1 root root    50615 Dec 23 17:39 vertica.metabase-driver.jar

Start Metabase:

MB_PLUGINS_DIR=./plugins; nohup  java -jar metabase.jar &

Error Info

12-23 18:27:55 ERROR driver.util :: Database connection error
java.lang.IllegalArgumentException: No method in multimethod 'connection-details->spec' for dispatch value: :clickhouse
        at clojure.lang.MultiFn.getFn(MultiFn.java:156)
        at clojure.lang.MultiFn.invoke(MultiFn.java:233)
        at metabase.driver.sql_jdbc.connection$details__GT_connection_spec_for_testing_connection.invokeStatic(connection.clj:152)
        at metabase.driver.sql_jdbc.connection$details__GT_connection_spec_for_testing_connection.invoke(connection.clj:147)
        at metabase.driver.sql_jdbc.connection$can_connect_QMARK_.invokeStatic(connection.clj:158)
        at metabase.driver.sql_jdbc.connection$can_connect_QMARK_.invoke(connection.clj:154)
        at metabase.driver.sql_jdbc$fn__69874.invokeStatic(sql_jdbc.clj:35)
        at metabase.driver.sql_jdbc$fn__69874.invoke(sql_jdbc.clj:34)
        at clojure.lang.MultiFn.invoke(MultiFn.java:234)
        at metabase.driver.util$can_connect_with_details_QMARK_$fn__21110.invoke(util.clj:32)
        at metabase.util$do_with_timeout$fn__13131.invoke(util.clj:302)
        at clojure.core$binding_conveyor_fn$fn__5754.invoke(core.clj:2030)
        at clojure.lang.AFn.call(AFn.java:18)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
12-23 18:27:55 DEBUG middleware.log :: POST /api/database 400 28.3 ms (0 DB calls) 
{:valid false,
 :dbname "No method in multimethod 'connection-details->spec' for dispatch value: :clickhouse",
 :message "No method in multimethod 'connection-details->spec' for dispatch value: :clickhouse"}
MLikeWater commented 4 years ago

I have downloaded metabase enterprise version, and I put the jar package in the plugins directory. As a result It works well.

yarhrn commented 4 years ago

I have a similar problem running a docker container build from the docker file in the readme. Also, there is an error during driver initialization


01-02 11:06:47 ERROR driver.util :: Database connection error
Syntax error compiling at (metabase/driver/clickhouse.clj:1:1).
    at clojure.lang.Compiler.load(Compiler.java:7648)
    at clojure.lang.RT.loadResourceScript(RT.java:381)
    at clojure.lang.RT.loadResourceScript(RT.java:372)
    at clojure.lang.RT.load(RT.java:459)
    at clojure.lang.RT.load(RT.java:424)
    at clojure.core$load$fn__6839.invoke(core.clj:6126)
    at clojure.core$load.invokeStatic(core.clj:6125)
    at clojure.core$load.doInvoke(core.clj:6109)
    at clojure.lang.RestFn.invoke(RestFn.java:408)
    at clojure.core$load_one.invokeStatic(core.clj:5908)
    at clojure.core$load_one.invoke(core.clj:5903)
    at clojure.core$load_lib$fn__6780.invoke(core.clj:5948)
    at clojure.core$load_lib.invokeStatic(core.clj:5947)
    at clojure.core$load_lib.doInvoke(core.clj:5928)
    at clojure.lang.RestFn.applyTo(RestFn.java:142)
    at clojure.core$apply.invokeStatic(core.clj:667)
    at clojure.core$load_libs.invokeStatic(core.clj:5985)
    at clojure.core$load_libs.doInvoke(core.clj:5969)
    at clojure.lang.RestFn.applyTo(RestFn.java:137)
    at clojure.core$apply.invokeStatic(core.clj:667)
    at clojure.core$require.invokeStatic(core.clj:6007)
    at clojure.core$require.doInvoke(core.clj:6007)
    at clojure.lang.RestFn.applyTo(RestFn.java:137)
    at clojure.core$apply.invokeStatic(core.clj:665)
    at clojure.core$apply.invoke(core.clj:660)
    at metabase.plugins.classloader$require.invokeStatic(classloader.clj:101)
    at metabase.plugins.classloader$require.doInvoke(classloader.clj:89)
    at clojure.lang.RestFn.invoke(RestFn.java:408)
    at metabase.plugins.init_steps$fn__67727.invokeStatic(init_steps.clj:22)
    at metabase.plugins.init_steps$fn__67727.invoke(init_steps.clj:20)
    at clojure.lang.MultiFn.invoke(MultiFn.java:229)
    at metabase.plugins.init_steps$do_init_steps_BANG_.invokeStatic(init_steps.clj:32)
    at metabase.plugins.init_steps$do_init_steps_BANG_.invoke(init_steps.clj:27)
    at metabase.plugins.lazy_loaded_driver$make_initialize_BANG_$fn__67766.invoke(lazy_loaded_driver.clj:58)
    at clojure.lang.MultiFn.invoke(MultiFn.java:229)
    at metabase.driver.impl$initialize_if_needed_BANG_.invokeStatic(impl.clj:179)
    at metabase.driver.impl$initialize_if_needed_BANG_.invoke(impl.clj:160)
    at metabase.driver$the_initialized_driver.invokeStatic(driver.clj:146)
    at metabase.driver$the_initialized_driver.invoke(driver.clj:142)
    at metabase.driver$dispatch_on_initialized_driver.invokeStatic(driver.clj:154)
    at metabase.driver$dispatch_on_initialized_driver.doInvoke(driver.clj:149)
    at clojure.lang.RestFn.invoke(RestFn.java:423)
    at clojure.lang.MultiFn.invoke(MultiFn.java:233)
    at metabase.driver.util$can_connect_with_details_QMARK_$fn__21110.invoke(util.clj:32)
    at metabase.util$do_with_timeout$fn__13131.invoke(util.clj:302)
    at clojure.core$binding_conveyor_fn$fn__5754.invoke(core.clj:2030)
    at clojure.lang.AFn.call(AFn.java:18)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.io.FileNotFoundException: Could not locate metabase/util/date__init.class, metabase/util/date.clj or metabase/util/date.cljc on classpath.
    at clojure.lang.RT.load(RT.java:462)
    at clojure.lang.RT.load(RT.java:424)
    at clojure.core$load$fn__6839.invoke(core.clj:6126)
    at clojure.core$load.invokeStatic(core.clj:6125)
    at clojure.core$load.doInvoke(core.clj:6109)
    at clojure.lang.RestFn.invoke(RestFn.java:408)
    at clojure.core$load_one.invokeStatic(core.clj:5908)
    at clojure.core$load_one.invoke(core.clj:5903)
    at clojure.core$load_lib$fn__6780.invoke(core.clj:5948)
    at clojure.core$load_lib.invokeStatic(core.clj:5947)
    at clojure.core$load_lib.doInvoke(core.clj:5928)
    at clojure.lang.RestFn.applyTo(RestFn.java:142)
    at clojure.core$apply.invokeStatic(core.clj:667)
    at clojure.core$load_libs.invokeStatic(core.clj:5989)
    at clojure.core$load_libs.doInvoke(core.clj:5969)
    at clojure.lang.RestFn.applyTo(RestFn.java:137)
    at clojure.core$apply.invokeStatic(core.clj:667)
    at clojure.core$require.invokeStatic(core.clj:6007)
    at clojure.core$require.doInvoke(core.clj:6007)
    at clojure.lang.RestFn.invoke(RestFn.java:930)
    at metabase.driver.clickhouse$eval194$loading__6721__auto____195.invoke(clickhouse.clj:1)
    at metabase.driver.clickhouse$eval194.invokeStatic(clickhouse.clj:1)
    at metabase.driver.clickhouse$eval194.invoke(clickhouse.clj:1)
    at clojure.lang.Compiler.eval(Compiler.java:7177)
    at clojure.lang.Compiler.eval(Compiler.java:7166)
    at clojure.lang.Compiler.load(Compiler.java:7636)
    ... 50 more
01-02 11:06:47 ERROR driver.util :: Database connection error
java.lang.IllegalArgumentException: No method in multimethod 'connection-details->spec' for dispatch value: :clickhouse
    at clojure.lang.MultiFn.getFn(MultiFn.java:156)
    at clojure.lang.MultiFn.invoke(MultiFn.java:233)
    at metabase.driver.sql_jdbc.connection$details__GT_connection_spec_for_testing_connection.invokeStatic(connection.clj:152)
    at metabase.driver.sql_jdbc.connection$details__GT_connection_spec_for_testing_connection.invoke(connection.clj:147)
    at metabase.driver.sql_jdbc.connection$can_connect_QMARK_.invokeStatic(connection.clj:158)
    at metabase.driver.sql_jdbc.connection$can_connect_QMARK_.invoke(connection.clj:154)
    at metabase.driver.sql_jdbc$fn__69874.invokeStatic(sql_jdbc.clj:35)
    at metabase.driver.sql_jdbc$fn__69874.invoke(sql_jdbc.clj:34)
    at clojure.lang.MultiFn.invoke(MultiFn.java:234)
    at metabase.driver.util$can_connect_with_details_QMARK_$fn__21110.invoke(util.clj:32)
    at metabase.util$do_with_timeout$fn__13131.invoke(util.clj:302)
    at clojure.core$binding_conveyor_fn$fn__5754.invoke(core.clj:2030)
    at clojure.lang.AFn.call(AFn.java:18)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)```
yarhrn commented 4 years ago

UPD: I managed to add clickhouse db by downgrading to metabase v0.33

enqueue commented 4 years ago

The Metabase 0.34 release has brought many changes to fix timezone related issues (see Release Announcement and issue list). This is a good thing™, but the drivers need to be updated.

pyrooka commented 4 years ago

The date utils has completely rewritten and renamed from metabase.util.date to metabase.util.date-2. I faced this problem with my driver too. Fortunately, I only had to change the name and some functions.

yarhrn commented 4 years ago

Got it, thanks!!!

argnist commented 4 years ago

Is there a workaround except downgrading to 0.33?

pyrooka commented 4 years ago

Is there a workaround except downgrading to 0.33?

I think, no.

argnist commented 4 years ago

Unfortunately we have the same error with Oracle in 0.33.x.

enqueue commented 4 years ago

@argnist the Oracle driver is supported by the Metabase team, and it would be strange if it did not work. Please check the support forum.

Meanwhile, I spent some time on the ClickHouse driver. Unfortunately, toggling the "legacy mode" for drivers, as hinted at by @camsaul is not a viable path for our driver, because the relevant JDBC methods, i.e. setting of date/time parameters with an optional Calendar instance to hold time zone, aren't implemented, either.

I am trying to build support for java.time into the JDBC driver, but it will take some time (see ClickHouse/clickhouse-jdbc#406)

pyrooka commented 4 years ago

@argnist I guess this is what caused the Oracle driver problem: https://github.com/metabase/metabase/issues/11699

long2ice commented 4 years ago

hello,any news?I really want use clickhouse in metabase,wonder why official support for clickhouse is not active...

enqueue commented 4 years ago

Sorry there isn't much news. I started working on the ClickHouse JDBC driver to include support for java.time data types. I do not know when the PR is ready for review, yet.

enqueue commented 4 years ago

If you are adventurous, feel free to try out 0.7 BETA release, and report your findings. We are particularly interested in reports regarding

The driver package includes my current fork of the JDBC driver (see branch jdbc_4.2) and a couple of adjustments of the actual Metabase ClickHouse driver.

Using the official test suite, we are currently down to 1 failure and 3 errors, which have to be fixed.

skaboy007 commented 4 years ago

I tested it by making a setup copy of my existing 0.6 + 0.33.6 to 0.7beta + 0.34.2 seems to be working fine. filter issues seem to be gone. did not see any issues at the moment. will be running it as if production for a few days. my case is fault-tolerant + I have the 0.6 + 0.33.6 running also.

dangerous1990 commented 4 years ago

I tested it by making a setup copy of my existing 0.6 + 0.33.6 to 0.7beta + 0.34.2 seems to be working fine. filter issues seem to be gone. did not see any issues at the moment. will be running it as if production for a few days. my case is fault-tolerant + I have the 0.6 + 0.33.6 running also.

Just replace clickhouse jar 0.6 to 0.7beta?

skaboy007 commented 4 years ago

I tested it by making a setup copy of my existing 0.6 + 0.33.6 to 0.7beta + 0.34.2 seems to be working fine. filter issues seem to be gone. did not see any issues at the moment. will be running it as if production for a few days. my case is fault-tolerant + I have the 0.6 + 0.33.6 running also.

Just replace clickhouse jar 0.6 to 0.7beta?

No, I made a full copy of the setup just in case.

enqueue commented 4 years ago

I released 0.7.0 including a fix for this issue.

I am not happy about the current state of the driver because it relies on a patched version of the official ClickHouse JDBC driver. But the driver should work fine with Metabase 0.34.x We have run 0.7-beta2 for a couple of weeks now without major problems.

vini-intenseye commented 10 months ago

Hi i have the same issue with the latest metabase.jar Metabase version: 0.44.2

Any hints?

Error 2023-11-13 13:06:04,290 DEBUG middleware.log :: POST /api/database 400 6.6 ms (0 DB calls) {:message "No method in multimethod 'connection-details->spec' for dispatch value: :clickhouse"}

slvrtrn commented 10 months ago

@vini-intenseye, the latest driver jar won't work on 0.44.2; there are too many breaking changes across the Metabase versions. See https://github.com/ClickHouse/metabase-clickhouse-driver#choosing-the-right-version

vini-intenseye commented 10 months ago

I just downgrade the plugin to get it working. thanks

slvrtrn commented 10 months ago

@vini-intenseye, it's better to upgrade Metabase; there have been a lot of bug fixes since 0.9.1.

wanggi404 commented 9 months ago

2023-12-05T19:24:57+07:00 DEBUG metabase.server.middleware.log POST /api/database 400 5.7 ms (1 DB calls) {:message "No method in multimethod 'connection-details->spec' for dispatch value: :clickhouse"}

i have same issue with metabase enterprise version v1.47.4,

do you guys have any recomend solution to fix this issue guys? im using driver v1.2.5

wanggi404 commented 9 months ago

2023-12-05T19:24:57+07:00 DEBUG metabase.server.middleware.log POST /api/database 400 5.7 ms (1 DB calls) {:message "No method in multimethod 'connection-details->spec' for dispatch value: :clickhouse"}

i have same issue with metabase enterprise version v1.47.4,

do you guys have any recomend solution to fix this issue guys? im using driver v1.2.5

sorry i didn't read carefully, im using driver v1.23 and now work perfectly