Originally created by: grynn-in
The konsol#110 review (grynn-in/konsolidat#151) found this script joining epm_gold.silver_legal_entities. [#151] repoints that join at epm_silver.silver_entity_currencies. Checking the rest of the query showed the script can't run at all on a current stack, and that has nothing to do with [#110].
scripts/build_consolidation_report.py:69-81 (discover_config):
SELECT cg.consolidation_group, cg.data_area_id, cg.entity_name,
cg.ownership_pct, cg.reporting_currency, cg.consolidation_method,
le.accounting_currency
FROM epm_gold.consolidation_groups AS cg
LEFT JOIN epm_gold.silver_legal_entities AS le
ON cg.data_area_id = le.data_area
WHERE ...
AND cg.consolidation_method = 'full'
ownership_pct and consolidation_method no longer exist on epm_gold.consolidation_groups. F2 retired them (konsol clickhouse.py _RETIRED_COLUMNS), and ensure_reference_tables() drops them. On the live stack, DESCRIBE epm_gold.consolidation_groups returns only consolidation_group, data_area_id, entity_name, reporting_currency. So the query fails with an unknown-identifier error.epm_gold.silver_legal_entities never existed. The model materialises in epm_silver. This part is fixed in [#151].What the script does NOT do: read ownership from where it now lives. Since F2 that is gold_entity_ownership (period-keyed, multi-level), and consolidation_ancestry for structure.
Take ownership_pct and consolidation_method from epm_gold.gold_entity_ownership for the report's period, the same source every consolidated model reads. Or read the per-entity rows straight from gold_consolidated_trial_balance, which already carries ownership_pct, consolidation_method and accounting_currency. Either way, add the script to a CI smoke step so a renamed column fails a PR instead of the next time someone runs it.
python scripts/build_consolidation_report.py against any stack deployed since F2 (11 Sep 2026). The first query fails on cg.ownership_pct.
🤖 Generated with Claude Code
Ticket changed by: grynn-in