Skip to content

Instantly share code, notes, and snippets.

@kzzzr
Last active April 9, 2022 12:45
Show Gist options
  • Save kzzzr/a214fed8db4d4ac694b55ee26cd126be to your computer and use it in GitHub Desktop.
Save kzzzr/a214fed8db4d4ac694b55ee26cd126be to your computer and use it in GitHub Desktop.
DE - DWH - Data Build Tool
# install dbt: https://docs.getdbt.com/dbt-cli/installation
pip install dbt==0.19.0
# clone repo
git clone https://github.com/dbt-labs/jaffle_shop
# create ~/.dbt/profiles.yml
# ensure profile setup
dbt debug
# load demo data
dbt seed
# run models
dbt run
# test models
dbt test
# Generate docs
dbt docs generate
# View docs
dbt docs serve
# Run PostgreSQL database in Docker container
docker pull postgres
docker run --name postgres -e POSTGRES_PASSWORD=postgres -d -p 5432:5432 postgres
# OPTIONAL – you may use DBeaver or DataGrip
## install cli
brew uninstall --force postgresql
brew install postgres
## login:pass postgres:postgres
psql -h localhost -p 5432 -U postgres
# !! Put in cd ~/.dbt/ folder
# For more information on how to configure this file, please see:
# https://github.com/fishtown-analytics/dbt/blob/master/sample.profiles.yml
# default:
# outputs:
# dev:
# type: redshift
# threads: 1
# host: 127.0.0.1
# port: 5439
# user: alice
# pass: pa55word
# dbname: warehouse
# schema: dbt_alice
# prod:
# type: redshift
# threads: 1
# host: 127.0.0.1
# port: 5439
# user: alice
# pass: pa55word
# dbname: warehouse
# schema: analytics
# target: dev
config:
# If True, dbt will track anonymized usage statistics. If set to
# False, no events will be tracked. See below for more information.
# Default: True
send_anonymous_usage_stats: False
# If True, dbt will colorize the terminal output. If False, the
# terminal output will not be colorized.
# Default: True
use_colors: True
jaffle_shop:
outputs:
dev:
type: postgres
threads: 2
host: localhost
port: 5432
user: postgres
pass: postgres
dbname: postgres
schema: dbt
target: dev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment