Note: Currently only setup for use with Postgres
dbt-metabase
is a dbt package that models the Metabase application database which contains detailed information about users, usage, questions and dashboards.
Inspired by this thread Metabase Metadata SQL
We strongly recommend using virtual environments when developing code in dbt-metabase
. We recommend creating this virtualenv
in the root of the dbt-metabase
repository.
To create a new virtualenv, run:
python3 -m venv env
source env/bin/activate
This will create and activate a new Python virtual environment.
After you have activated your virtual environment
pip install -r requirements.txt
make install-dependencies
This option sets up Metabase, the Postgres DB and creates the schemas required using docker exec
. You can do this yourself by looking at the code in the Makefile if you find it easier and/or don't have Make installed.
make setup-metabase
docker-compose up -d database
docker ps -a --filter "name=database" --format "{{.ID}}"
# DATABASE_CONTAINER_ID is the output of the above docker ps command
docker exec -it <DATABASE_CONTAINER_ID> psql -U root dbt --command "CREATE DATABASE metabase";
docker-compose up -d metabase
make db-connect
docker ps -a --filter "name=database" --format "{{.ID}}"
# DATABASE_CONTAINER_ID is the output of the above docker ps command
docker exec -it <DATABASE_CONTAINER_ID> psql -U root dbt
Useful Postgres commands
\c metabase # connect to the metabase database
\x on # Turn expanded display on. Makes viewing easier when working in terminal
\dn # List schemas
make down
docker-compose down
The Metabase Docker image will always build the Metabase internal database in the "public" schema of the "metabase" database in Postgres.
Therefore you will need to overide the metabase_schema var when running locally.
dbt run --select +metabase_download_activity --vars '{"metabase_schema": "public"}'