Template to create self-contained dev container demos of transforming data with dbt. Useful for interviews.
- Install Docker.
- Install VS Code and install the Dev Containers extension.
- Open this folder in a container in VS Code.
- Open a VS Code terminal. You should see the following prompt:
If you see it, you're now in a development container with dbt pre-installed and pre-configured!
vscode ➜ /workspace (main) $
- Copy your CSV file into
seeds/
to use it as a dbt seed. - Run
dbt seed
- Generate dbt schema for your seed using the following command (be sure to replace "test" with the basename of your CSV file):
Copy and paste the output to a new file
dbt run-operation generate_model_yaml --args '{"model_name": "test"}'
seeds/schema.yml
, replacing 'models:' with 'seeds:'. Re-generate the docs withdbt docs generate
and you should now be able to see your source declaration when you refresh http://localhost:8081 - Code your transformations as usual. Some useful references:
- To update docs, run
dbt docs generate
. The updated documentation will be available on refresh at http://localhost:8081. - Run the transformations with
dbt run
and tests withdbt test
as usual. - Query your table data in Adminer at http://localhost:8080. Choose "PostgreSQL" as the system, leave "warehouse" as the server, and enter "postgres" as both the username and password.
Based on Microsoft's python3-postgres example.