Skip to content

Victoriapm/dbt-basics-workshop

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Welcome to the DBT-in-Practice Workshop with Victoria Perez Mola by Dat0s! image

How to run this project

Prerequisites

We will build a project using dbt and a postgres database, but any other database of your choice could be used. The requirements are:

  • docker to run postgres and can be used for dbt as well (optional)
  • postgres (optional - but a database is needed). Follow this link for instructions on how to install and create a database. I used one database 'production' with a schema for local development 'dbt_victoria_mola' and another schema 'master' for production deployment.
  • dbt (local installation) Follow link for instructions or use a docker image from oficial dbt repo

About the data

This project is based in open data sets found in Kaggle.com:

About the project

This project is based in dbt starter project (generated by running dbt init) Try running the following commands:

  • dbt run
  • dbt test

A project includes the following files:

  • dbt_project.yml: file used to configure the dbt project, make sure the profile here matches the one setup during local installation in ~/.dbt/profiles.yml
  • csv files in the data folder: these will be our sources, files described above
  • Files inside folder models: The sql files contain the scripts to run our models, this will cover staging, core and a datamarts models. At the end, these models will follow this structure:

image

Workflow

image

Execution

After having installed the required tools and cloning this repo, execute the following commnads:

  1. Change into the project's directory from the command line: $ cd dbt-basics-workshop/complete-project
  2. Load the CSVs into the database. This materializes the CSVs as tables in your target schema: $ dbt seed
  3. Run the models: $ dbt run
  4. Generate documentation for the project: $ dbt docs generate
  5. View the documentation for the project, this step should open the documentation page on a webserver, but it can also be accessed from http://localhost:8080 : $ dbt docs serve

Resources:

  • 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