Originally created by: grynn-in
Fixes [#60].
A fresh deploy ships D365-only demo data, but erp_sources defaulted to [d365_fo, erpnext]. The stg_erpnext__* models ran against epm_raw tables that were never loaded and errored; because the canonical models UNION over erp_sources, those 7 failures cascaded into 169 skipped downstream models — including gold_trial_balance, the actuals fact the Excel =EPM() API reads.
Make erp_sources the single source of truth for which ERPs are active:
[d365_fo] (matches the shipped demo).+enabled keyed on membership in erp_sources, so a fresh dbt build never builds staging for an ERP whose raw tables aren't present. Enablement and the canonical UNION now read the same var, so they can't drift.ERPNext deployments opt in:
dbt build --vars '{erp_sources: [d365_fo, erpnext]}'
dbt build, no flags — what deploy.sh runs)| before | after | |
|---|---|---|
| result | PASS=73 ERROR=7 SKIP=169 | PASS=190 ERROR=4 SKIP=42 |
gold_trial_balance |
not built | 58 rows |
stg_erpnext__* tables |
7 errors | 0 (cleanly disabled) |
The remaining 4 errors are pre-existing, unrelated test issues tracked in [#70].
Originally posted by: grynn-in
Independent review — APPROVE WITH NITS
Mechanism is correct:
+enabled: "{{ 'erpnext' in var('erp_sources', ['d365_fo']) }}"resolves at parse time (dbt coerces the renderedTrue/Falseto bool forenabled), and because the canonical models loop over the samevar('erp_sources', ['d365_fo']), enablement and the UNION can't drift — no "depends on a disabled node" error for[d365_fo],[erpnext], or[d365_fo, erpnext]in the canonical layer. Default-change blast radius is clean: every reader uses the explicit['d365_fo']default.One real nit to document before merge: the
bronze/layer refsstg_d365_fo__*models directly (not via theerp_sourcesloop) — ~11 models, e.g.bronze_general_journal_entries→ref('stg_d365_fo__gl_journal_entries'). Soerp_sources=[erpnext](D365 excluded) would disable those staging models while bronze still hard-refs them → parse error. This is not a problem for the PR's goal (d365_fo is the default and D365 is the only single-switch target), but it meanserp_sourcesis really "D365 mandatory, ERPNext optional", not a symmetric switch. Suggest a one-line note in theerp_sourcescomment thatd365_fomust remain present (bronze depends on it directly).Verified separately: bare
dbt buildPASS 73→190, 0 stg_erpnext tables, gold_trial_balance builds.Ticket changed by: grynn-in