GithubHelp home page GithubHelp logo

dbt-metabase's Introduction

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

Development

Setup a virtual environment

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.

Installing Dependencies

Using the terminal

After you have activated your virtual environment

pip install -r requirements.txt

Using the Makefile

make install-dependencies

Setup Environment

Using the Makefile (Recommended)

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

Using docker compose

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

Connecting to the docker-compose Postgres Database

make db-connect

Using docker compose

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

Bringing down the Environment

Using the Makefile

make down

Using docker compose

docker-compose down

Running dbt locally

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"}'

dbt-metabase's People

Contributors

jared-rimmer avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.