Environment
-
Metabase version: 0.56.10.x
-
Custom driver: Apache IoTDB (JDBC 2.0.6-ls from private Maven repo:
https://repo.custom.com) -
Build environment: Linux
-
Build method: Running
./bin/build-driver.sh iotdbunder the Metabase source root -
Metabase installation: Docker container
Problem Description
When running the official Metabase build script:
./bin/build-driver.sh iotdb
The build completes without explicit errors, but the compiled classes are not generated, specifically:
metabase/driver/iotdb__init.class
metabase/driver/iotdb.class
Only the .clj file appears inside the JAR:
/data/workspace/data/metabase/modules/drivers/iotdb/target/jar/metabase/driver/iotdb.clj
However, when starting Metabase or trying to require the namespace, we get:
metabase/driver/iotdb.clj not found in classpath
Questions
-
How should a third-party driver properly depend on or extend
sql-jdbcduring thebuild-driver.shprocess? -
Is there a supported way to add
modules/drivers/sql-jdbcto the build classpath (viadeps.ednor build alias)? -
Could
build-driver.shbe improved to print compile-time errors instead of silently skipping them?
The code detail
iotdb.clj
(ns metabase.driver.iotdb
"Metabase driver for Apache IoTDB (Custom JDBC)"
(:require [metabase.driver :as driver]
[metabase.driver.sql-jdbc :as sql-jdbc]
[metabase.driver.sql-jdbc.connection :as sql-jdbc.conn]))
;; 注册驱动,继承自sql-jdbc
(driver/register! :iotdb :parent :sql-jdbc)
;; 定义连接字符串模板
(defn- connection-details->spec [details]
(let [host (get details :host "localhost")
port (get details :port 6667)
url (format "jdbc:iotdb://%s:%s/" host port)]
(merge {:classname "org.apache.iotdb.jdbc.IoTDBDriver"
:subprotocol "iotdb"
:subname url
:user (get details :user)
:password (get details :password)}
(dissoc details :host :port :user :password))))
;; 实现必要的协议方法
(defmethod sql-jdbc.conn/connection-details->spec :iotdb
[_ details]
(connection-details->spec details))
plugin.json
{
"name": "Metabase IoTDB Driver",
"version": "1.0.0",
"description": "Allows Metabase to connect to Apache IoTDB databases.",
"driver": {
"name": "iotdb",
"display-name": "Apache IoTDB",
"lazy-load": true,
"parent": "sql-jdbc",
"connection-properties": [
"host",
{
"merge": [
"port",
{"placeholder": 6667}
]
},
"user",
"password",
"cloud-ip-address-info",
"advanced-options-start",
"default-advanced-options"
]
},
"init": [
{
"step": "load-namespace",
"namespace": "metabase.driver.iotdb"
},
{
"step": "register-jdbc-driver",
"class": "org.apache.iotdb.jdbc.IoTDBDriver"
}
]
}
deps.edn
{:paths
["src" "resources"]
:deps
{org.apache.iotdb/iotdb-jdbc {:mvn/version "2.0.6"}}
}