Created
June 13, 2024 07:28
-
-
Save DaveFlynn/9412e4e558aed6ea131329ba334e5f9e to your computer and use it in GitHub Desktop.
Makefile boilerplate for dbt projects
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
include .env | |
export | |
# Phony targets | |
.PHONY: build seed test snapshot run debug clean help | |
# Environment variables | |
TARGET ?= $(TARGET) | |
PROFILE ?= $(PROFILE) | |
build: | |
@echo "Running dbt build with target: $(TARGET) and profile: $(PROFILE)" | |
dbt build --target $(TARGET) --profile $(PROFILE) | |
seed: | |
@echo "Seeding" | |
dbt seed --target $(TARGET) --profile $(PROFILE) | |
test: | |
@echo "Testing" | |
dbt test --target $(TARGET) --profile $(PROFILE) | |
snapshot: | |
@echo "Running snapshot" | |
dbt snapshot --target $(TARGET) --profile $(PROFILE) | |
run: | |
@echo "Running dbt" | |
dbt run --target $(TARGET) --profile $(PROFILE) | |
debug: | |
@echo "Debugging dbt connection" | |
dbt debug --target $(TARGET) --profile $(PROFILE) | |
docs: | |
dbt docs generate && dbt docs serve | |
clean: | |
@echo "Cleaning dbt environment and installing dependencies" | |
dbt clean && dbt deps | |
help: | |
@echo "Available commands" | |
@echo " build - dbt build with an optional TARGET=target_name and PROFILE=profile_name " | |
@echo " seed - Seed data" | |
@echo " test - Test models" | |
@echo " snapshot - Run snapshots" | |
@echo " run - Run models" | |
@echo " debug - Debug dbt connection" | |
@echo " docs - Generate dbt documentation" | |
@echo " clean - Clean environment and install dependencies" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment