Skip to content

Commit 290f9eb

Browse files
committed
add readme
1 parent b94d967 commit 290f9eb

2 files changed

Lines changed: 64 additions & 2 deletions

File tree

README.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Metabase Databend Driver
2+
3+
## Installation
4+
5+
## Configuring
6+
7+
1. Once you've started up Metabase, open http://localhost:3000 , go to add a database and select "Databend".
8+
2. You'll need to provide the Host/Port, Database Name, Username and Password.
9+
10+
### Prerequisites
11+
12+
- [Leiningen](https://leiningen.org/)
13+
14+
### Build from source
15+
16+
1. Clone and build metabase dependency jar.
17+
18+
```shell
19+
git clone https://github.com/metabase/metabase
20+
cd metabase
21+
clojure -X:deps prep
22+
cd modules/drivers
23+
clojure -X:deps prep
24+
cd ../..
25+
clojure -T:build uberjar
26+
```
27+
28+
2. Clone metabase-databend-driver repo
29+
30+
```shell
31+
cd modules/drivers
32+
git clone https://github.com/databendcloud/metabase-databend-driver
33+
```
34+
35+
3. Prepare metabase dependencies
36+
37+
```shell
38+
cp ../../target/uberjar/metabase.jar metabase-databend-driver/
39+
cd metabase-databend-driver
40+
mkdir repo
41+
mvn deploy:deploy-file -Durl=file:repo -DgroupId=com.databend -DartifactId=metabase-core -Dversion=1.40 -Dpackaging=jar -Dfile=metabase.jar
42+
```
43+
44+
4. Build the jar
45+
46+
```shell
47+
LEIN_SNAPSHOTS_IN_RELEASE=true DEBUG=1 lein uberjar
48+
```
49+
50+
5. Let's assume we download `metabase.jar` from the [Metabase jar](https://www.metabase.com/docs/latest/operations-guide/running-the-metabase-jar-file.html) to `~/metabase/` and we built the project above. Copy the built jar to the Metabase plugins directly and run Metabase from there!
51+
52+
```shell
53+
cd ~/metabase/
54+
java -jar metabase.jar
55+
```
56+
57+
You should see a message on startup similar to:
58+
59+
```
60+
2019-05-07 23:27:32 INFO plugins.lazy-loaded-driver :: Registering lazy loading driver :databend...
61+
2019-05-07 23:27:32 INFO metabase.driver :: Registered driver :databend (parents: #{:sql-jdbc}) 🚚
62+
```

src/metabase/driver/databend.clj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@
184184
(merge table-metadata {:fields (set filtered-fields)})))
185185

186186
; Return a native query that will fetch the current time
187-
(defmethod driver.common/current-db-time-native-query :firebolt [_]
187+
(defmethod driver.common/current-db-time-native-query :databend [_]
188188
"SELECT CAST(CAST(NOW() AS TIMESTAMP) AS VARCHAR(24))")
189189

190190
(defn- to-start-of-year
@@ -279,7 +279,7 @@
279279
(format "'%s'" (t/format "HH:mm:ss.SSSZZZZZ" t)))
280280

281281
; Converting OffsetDateTime datatype to SQL-style literal string
282-
(defmethod unprepare/unprepare-value [:firebolt OffsetDateTime]
282+
(defmethod unprepare/unprepare-value [:databend OffsetDateTime]
283283
[_ t]
284284
(format "'%s'" (u.date/format-sql (t/local-date-time t))))
285285

0 commit comments

Comments
 (0)