Appearance
Local dbt
Use the local dbt container for SQL transformations, model tests, model documentation, and lineage metadata. dbt should own select-based models; Alembic and SQLAlchemy should continue to own foundational database DDL.
Start From the Local Stack
sh
cp .env.example .env
make postgres-up
make db-upgrade
make dbt-debugThe dbt project lives in:
dbt/
The dbt Compose service runs with:
DBT_PROFILES_DIR=/workspace/dbt- Working directory
/workspace/dbt
Common Commands
sh
make dbt-debug
make dbt-run
make dbt-test
make dbt-docs-generateThe default local target is mart, which writes to edp_mart.
Override targets with:
sh
DBT_TARGET=ods make dbt-run
DBT_TARGET=vault make dbt-run
DBT_TARGET=raw make dbt-runProject Layout
dbt/models/stagingfor source-shaped cleanup and typed projectionsdbt/models/intermediatefor reusable business logic and cross-source joinsdbt/models/martsfor dashboard-facing and application-facing datasetsdbt/testsfor custom data testsdbt/macrosfor reusable SQL helpersdbt/seedsfor small controlled reference datasetsdbt/snapshotsfor dbt-managed snapshots when they are a better fit than EDP Data Vault history
Guidance
Use dbt for:
- Views and tables derived from existing raw, ODS, Vault, or Mart structures
- Data tests such as uniqueness, accepted values, relationships, and freshness
- Model documentation and lineage
- Reusable analytical transformations
Use Alembic for:
- Schemas
- Base tables
- Primary keys and foreign keys
- Indexes
- Database extensions
- Operational application tables
Troubleshooting
If make dbt-debug cannot connect:
- Confirm
make postgres-upsucceeds. - Confirm
DBT_PG_HOSTispgbouncerfor Compose-based runs. - Confirm
DBT_PG_USERandDBT_PG_PASSWORDmatch.env. - Confirm the target database exists.
If dbt reports no models:
- Add SQL files under
dbt/models/staging,dbt/models/intermediate, ordbt/models/marts.