dbt project for Bandsintown analytics on AWS Athena (Presto/Trino dialect), S3-backed Parquet/Snappy data. Orchestrated via Airflow (MWAA), infra managed by Serverless Framework.
sources (Glue/Athena) → stg_ (view) → int_ (view) → dim_/fct_/mart_ (table)
- Adapter:
dbt-athena-community— useCAST()not::,varcharnottext - Profiles:
--profiles-dir .(repo rootprofiles.yml), env varDBT_TARGET=dev|staging|prod - Schema routing:
macros/generate_schema_name.sql
| Layer | Prefix | Reads from | Forbidden |
|---|---|---|---|
| Staging | stg_* |
source() only |
complex JOINs, GROUP BY, aggregations |
| Intermediate | int_* |
ref('stg_...') only |
dims, facts, marts, source() |
| Marts | dim_*, fct_*, mart_* |
ref('stg_...'), ref('int_...'), ref('dim_...'), ref('fct_...') |
source() |
Dependency flow: sources → stg_ → int_ → dim_/fct_/mart_
See .agent/DBT_LAYERING_STANDARDS.md for full rules and examples.
make setup # Dev environment setup
make run # Run all models (dev target)
make run-model MODEL=x # Single model
make lint # sqlfluff (athena dialect)
make lint-fix # Auto-fix SQL
make test # dbt tests
make compile # Compile without executing- Model configs: Always include
materializedandtagsin{{ config() }} - Sources:
_sources.ymlcolocated inmodels/staging/<domain>/ - Macros: Reuse
macros/cents_to_dollars.sqlandmacros/union_tables.sqlbefore writing inline logic - Staging: SELECT + CAST + rename + basic filtering. One model per source table. Materialized as
view. - Intermediate: Joins, unions, window functions across staging models. Materialized as
view. - Dims/Facts/Marts: Denormalized presentation-layer tables. Materialized as
tablewithformat: parquet,write_compression: snappy.
models/staging/<domain>/ — stg_ views + _sources.yml
models/intermediate/ — int_ views (cross-staging reshaping)
models/marts/<domain>/ — dim_, fct_, mart_ tables (grouped by domain)
macros/ — shared SQL macros
dags/ — Airflow DAGs for MWAA
environment/ — Serverless Framework IaC
scripts/ — deploy, validate, setup scripts
scripts/deploy.sh— deploys Serverless infrascripts/upload_dbt_payload.py— uploads compiled dbt artifacts to S3dags/dbt_marts_core.py— Airflow DAG that runs dbt in MWAA