cognitect-labs / metabase-datomic

Datomic driver for Metabase

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

metabase-datomic

A Metabase driver for Datomic.

Commercial support is provided by Gaiwan.

Try it!

docker run -p 3000:3000 lambdaisland/metabase-datomic

Design decisions

See the Architecture Decision Log

Developing

To get a REPL based workflow, do a git clone of both metabase and metabase-datomic, such that they are in sibling directories

$ git clone git@github.com:metabase/metabase.git
$ git clone git@github.com:plexus/metabase-datomic.git

$ tree -L 1
.
│
├── metabase
└── metabase-datomic

Before you can use Metabase you need to build the frontend. This step you only need to do once.

cd metabase
yarn build

And install metabase locally

lein install

Now cd into the metabase-datomic directory, and run bin/start_metabase to lauch the process including nREPL running on port 4444.

cd metabase-datomic
bin/start_metabase

Now you can connect from Emacs/CIDER to port 4444, or use the bin/cider_connect script to automatically connect, and to associate the REPL session with both projects, so you can easily evaluate code in either, and navigate back and forth.

Once you have a REPL you can start the web app. This also opens a browser at localhost:3000

user=> (go)

The first time it will ask you to create a user and do some other initial setup. To skip this step, invoke setup!. This will create a user with username arne@example.com and password dev. It will also create a Datomic database with URL datomic:free://localhost:4334/mbrainz. You are encouraged to run a datomic-free transactor, and import the MusicBrainz database for testing.

user=> (setup!)

Installing

The general process is to build an uberjar, and copy the result into your Metabase plugins/ directory. You can build a jar based on datomic-free, or datomic-pro (assuming you have a license). Metabase must be available as a local JAR.

cd metabase
lein install
mkdir plugins
cd ../metabase-datomic
lein with-profiles +datomic-free uberjar
# lein with-profiles +datomic-pro uberjar
cp target/uberjar/datomic.metabase-driver.jar ../metabase/plugins

Now you can start Metabase, and start adding Datomic databases

cd ../metabase
lein run -m metabase.core

Status

FeatureSupported?
Basics
    {:source-table integer-literal}Yes
    {:fields [& field]}Yes
        [:field-id field-id]Yes
        [:datetime-field local-field | fk unit]Yes
    {:breakout [& concrete-field]}Yes
        [:field-id field-id]Yes
        [:aggregation 0]Yes
        [:datetime-field local-field | fk unit]Yes
    {:filter filter-clause}
        [:and & filter-clause]Yes
        [:or & filter-clause]Yes
        [:not filter-clause]Yes
        [:= concrete-field value & value]Yes
        [:!= concrete-field value & value]Yes
        [:< concrete-field orderable-value]Yes
        [:> concrete-field orderable-value]Yes
        [:<= concrete-field orderable-value]Yes
        [:>= concrete-field orderable-value]Yes
        [:is-null concrete-field]Yes
        [:not-null concrete-field]Yes
        [:between concrete-field min orderable-value max orderable-value]Yes
        [:inside lat concrete-field lon concrete-field lat-max numeric-literal lon-min numeric-literal lat-min numeric-literal lon-max numeric-literal]Yes
        [:starts-with concrete-field string-literal]Yes
        [:contains concrete-field string-literal]Yes
        [:does-not-contain concrete-field string-literal]Yes
        [:ends-with concrete-field string-literal]Yes
        [:time-interval field concrete-field n :current|:last|:next|integer-literal unit relative-datetime-unit]
    {:limit integer-literal}Yes
    {:order-by [& order-by-clause]}Yes
:basic-aggregations
    {:aggregation aggregation-clause}
        [:count]Yes
        [:count concrete-field]Yes
        [:cum-count concrete-field]Yes
        [:cum-sum concrete-field]Yes
        [:distinct concrete-field]Yes
        [:sum concrete-field]Yes
        [:min concrete-field]Yes
        [:max concrete-field]Yes
        [:share filter-clause]
:standard-deviation-aggregationsYes
    {:aggregation aggregation-clause}Yes
        [:stddev concrete-field]Yes
:foreign-keysYes
    {:fields [& field]}Yes
        [:fk-> fk-field-id dest-field-id]Yes
:nested-fields
:set-timezone
:expressions
    {:fields [& field]}
        [:expression]
    {:breakout [& concrete-field]}
        [:expression]
    {:expressions {expression-name expression}}
:native-parameters
:expression-aggregations
:nested-queriesYes
    {:source-query query}Yes
:binning
:case-sensitivity-string-filter-optionsYes

License

Copyright © 2019 Arne Brasseur

Licensed under the term of the Mozilla Public License 2.0, see LICENSE.

About

Datomic driver for Metabase

License:Mozilla Public License 2.0


Languages

Language:Clojure 97.4%Language:Ruby 1.2%Language:Shell 0.8%Language:Dockerfile 0.4%Language:Emacs Lisp 0.2%