A Dockerized dbt Workflow

How to setup dbt using docker containers with an RPC server for Dagster

Photo by Todd Cravens on Unsplash

Dockerized dbt RPC server

dbt-postgres==1.0.0
dbt-rpc==0.1.1
dbt-snowflake==1.0.0
dbt-rpc==0.1.1
docker build -t dbt .
docker run -p 8581:8580 --name dbt_rpc -v "/$(pwd):/app" --env-file ./.env -it dbt
curl — location — request POST ‘localhost:8581/jsonrpc’ \
— header ‘Content-Type: application/json’ \
— data-raw ‘{
“jsonrpc”: “2.0”,
“method”: “status”,
“id”: “000000000”
}’

Improving the development workflow

docker run --name dbt_console -v "/$(pwd):/app" --env-file ./.env --entrypoint /bin/bash -it dbt

Composing everything together

docker exec -it dbt_console /bin/bash

--

--

Economist • Insights Lead @ Belvo • Ex-Data Analytics Manager @ Zenvia • Ex-Head of Data @ Sirena

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Juan Gesino

Economist • Insights Lead @ Belvo • Ex-Data Analytics Manager @ Zenvia • Ex-Head of Data @ Sirena