dbt Set Up - iff133/first GitHub Wiki

1. Instal dbt: command: pip install dbt

2. Create a dbt project: command: dbt init [project_name] This does three things:

  • creates a ~/.dbt/profiles.yml file if one does not already exist
  • creates a new folder called [project_name]
  • generates directories and sample files necessary to get started with dbt (https://docs.getdbt.com/docs/init)

3. Change the profile.yml file:

3.1 To save the changes:

4. Create Models:

  • Each model is equivalent to a job and uses SQL (select statements) image
  • Create a .sql file for every job that you want to run
  • The {{ config(materialized='table') }} can be used so that the output is a new table in the database
  • The name for the table will be the same as the name of the .sql file image
  • The ref function can be used to select data from other models image

5. Run the models: commnad: dbt run

6. Access project's documentation:

https://docs.getdbt.com/docs/documentation-website

Useful Links

https://blog.getdbt.com/what--exactly--is-dbt-/ https://docs.getdbt.com/ https://gitlab.demarq.com/demarq/dbt_mi/tree/master https://apple.stackexchange.com/questions/52461/how-to-save-and-exit-nano-bash-profile-in-terminal