This repo contains the data model of the funbro app. DBT is used to update, build and auto-document the data model.
The target database is postgres and the connection details live in the profiles.yml
file.
DBT expects the profiles.yml
file to live under ~/.dbt/profiles.yml
but it is possible to pass it a custom path with the --profiles-dir
flag. An example profiles.yml
is included in the root of this repo for convenience. You can use it right away by adding the --profiles-dir .
flag.
By default, the profiles.yml
file included in this repo requires connecting to postgres securely using SSL. DBT expects a folder to exist in your home directory named ~/.postgresql
containing the following 3 required files:
- postgresql.crt
- postgresql.key
- root.crt
Read more about that here. Alternatively, you can just connect with user and password if your postgres instance is not configured to accept only SSL connections. Read more in the DBT docs on configuring postgres.
It's a good idea to tune the instance accordingly, since postgres defaults are very conservative. This site can help a lot along this reference.
We will manage the environment with poetry:
poetry env use <your virtualenv path>
poetry shell
poetry update
Run the entire model:
dbt run
Same but only for a given model:
dbt run --model funbro.dim_title_genre
Run all the database tests (schema and data tests):
dbt test
You can render the models and check them running the following and then checking the target
directory:
dbt compile
Generate and serve the docs (exposes a static site at port 8080):
dbt docs generate && dbt docs serve
- Learn more about dbt in the docs
- Check out Discourse for commonly asked questions and answers
- Join the chat on Slack for live discussions and support
- Find dbt events near you
- Check out the blog for the latest news on dbt's development and best practices