Couchbase database driver for the Metabase. This is still an experimental project, it provides the SQL(N1QL) support and limited features basing on MBQL.
As a noSQL database, the coucbhase doesn't have the concept of table, this driver maps the coubhase bucket to the DB in the Metabase,
and it requires you to have a type field _type to define the documents in a table.
Go to the Metabase admin page and add a new database,
The Database name needs to be the bucket name, Host, Username and Password are self-explanatory.
The Table defintion tells the Metabase the schema of the document in the bucket.
-
name: the table name in Metabase -
schema: it's used to identify which documents belong to this table, it can either astringto present the value ofdoc._type, or a column separated string defines the doc type. e.g."schema": "mytype:Ticket"will select all documents withmytype=Ticketfrom the bucket. -
fieldsname: column nametype: the JSON type of the field, optional.pk?: a boolean whether it's primary keydatabase-position: column positionbase-type: the Metabase type defined in types.clj without:type/prefix, optional.
-
Example
{"tables":[{"name": "order", "schema": "Order",
"fields": [{ "name": "id", "type": "string","database-position": 0, "pk?": true},
{ "name": "state", "type": "string","database-position": 1 },
{ "name": "userPhoneNumber", "type": "string","database-position": 2 },
{ "name": "SKU code", "type": "string","database-position": 3 },
{ "name": "productName", "type": "string","database-position": 4 },
{ "name": "amount", "type": "number","database-position": 5 },
{ "name": "createdAt", "base-type": "Text","database-position": 6 }]}]}Clone the Metabase repo first if you haven't already done so.
cd /path/to/metabase_source
lein install-for-building-drivers# (In the Couchbase driver directory)
lein clean
DEBUG=1 LEIN_SNAPSHOTS_IN_RELEASE=true lein uberjarmkdir -p /path/to/metabase/plugins/
cp target/uberjar/couchbase.metabase-driver.jar /path/to/metabase/plugins/
jar -jar /path/to/metabase/metabase.jardocker build -t xavchow/metabase-with-cb .
docker run --rm -p 3000:3000 --name metabase xavchow/metabase-with-cb
Option 2, build with release package.
Go to the ./build directory, build with docker file Dockerfile-tag with sepcified version,
docker build -f Dockerfile-tag -t xavchow/metabase-with-cb --build-arg DRIVER_VERSION=v1.0.5 .
or build with latest release,
docker build -f Dockerfile-latest -t xavchow/metabase-with-cb .
Then,
docker run --rm -p 3000:3000 --name metabase xavchow/metabase-with-cb
Licensed under MIT
