Reference Data (formerly Seeds)
The dbt project has no seeds. The seeds directory was deleted in konsolidat 85dff3b (2026-09-12, #147: "every table is konsol-owned or derived"). Before that, 9cd5126 (#144, F3) moved every governed reference table to a single path: a konsol doctype is the source of truth and writes through to ClickHouse on publish, and the dbt models read that table as a source(). The reason (konsolidat#146): a seed materialises into epm_gold, the same relation konsol was writing, so dbt seed and bench migrate overwrote each other, and a governed build re-seeded a June CSV over the live tree.
This page keeps its URL. It now lists which konsol doctype feeds which table, and which models read it. Mapping read from konsol/konsol/**/doctype/*/*.py and konsol/clickhouse.py (_REFERENCE_TABLE_DDL), and from dbt_project/models/staging/_staging__sources.yml.
How a write-through works
- A doctype's
on_update/on_submit/on_trashhook callsclickhouse.sync_doctype(), whichTRUNCATE + INSERTs the whole table after the Frappe transaction commits (konsol#124). Published rows only, or submitted rows (docstatus = 1) for a submittable doctype. reconcile_all()re-syncs every table afterbench migrateand stamps each with onereconcile_run_id.- Every successful sync stamps
epm_staging.sync_watermark;assert_staging_not_stalefails the dbt build when a table is emptied or missed by the latest reconcile run. - konsol owns the DDL (
ensure_reference_tables()on migrate;clickhouse/init-db.sqlon a fresh volume; the two are kept identical by tests in both repos).
Doctype to table
| konsol doctype | ClickHouse table | Read by |
|---|---|---|
| Main Account | epm_staging.main_accounts | silver_main_accounts (its only source; fx_method decides the translation rate, is_retained_earnings the close account) |
| Entity | epm_staging.entities | silver_entity_currencies; the deal journals |
| EPM Fiscal Year / EPM Fiscal Year Period | epm_staging.fiscal_periods | silver_tb_movements (Closing period), rate_period_map(), the hierarchy roll-ups, the deal journals |
| Group Exchange Rate | epm_staging.group_exchange_rates | gold_consolidated_trial_balance (the only FX source for translation; rate is the true rate, never scaled or inverted), the deal journals, governed_rate_guard() |
| Historical Equity Rate | epm_staging.historical_equity_rates | gold_consolidated_trial_balance (accounts whose fx_method = 'historical') |
| ISO Currency | epm_gold.currencies | FX validation and the magnitude check (usd_log10) in governed_rate_gaps() |
| Consolidation Group | epm_gold.consolidation_groups (structure, policy and declared accounts on the root row data_area_id = ''), epm_staging.consolidation_hierarchy (flat tree), epm_staging.consolidation_ancestry (link closure) | gold_consolidation_hierarchy, gold_entity_ownership, gold_consolidated_trial_balance, gold_ic_reconciliation, gold_ic_eliminations, gold_nci_movement_schedule, gold_equity_method_associates, the deal journals |
| Ownership Period | epm_staging.ownership_periods | gold_entity_ownership (via ownership_resolution_ctes()), gold_acquisition_adjustments |
| Intercompany Account | epm_staging.intercompany_accounts | ic_account_map() → gold_ic_reconciliation, gold_ic_eliminations, gold_ic_unmatched |
| IC Elimination Rule | epm_staging.ic_elimination_rules | gold_ic_eliminations (only rule_type = 'unrealized_profit' still eliminates anything) |
| IC Balance | epm_staging.ic_balances | gold_ic_eliminations (unrealised profit) |
| Consolidation Journal | epm_staging.consolidation_adjustments | gold_consolidation_adjustments (Approved and Reversed rows; reverse_fiscal_year / reverse_fiscal_period drive the auto-reversal, konsol#305) |
| Business Combination (+ Consideration, Acquired Balance, Cost children) | epm_staging.business_combinations, ..._consideration, ..._acquired_balances, ..._costs | gold_business_combination_journal, gold_goodwill_amortisation_journal |
| Business Disposal (+ Proceeds child) | epm_staging.business_disposals, business_disposal_proceeds | gold_business_disposal_journal, gold_goodwill_amortisation_journal (the schedule stops at disposal) |
| Scenario | epm_gold.scenario_definitions | gold_scenario_versions, gold_scenario_trial_balance, the three variance models (which scenario is actual, which are budgets: scenario_type) |
| Spread Profile | epm_gold.spread_profiles | gold_spread_budget |
| Budget Annual Input | epm_gold.budget_annual_input | gold_spread_budget (annual spread branch) |
| Budget Sheet (on cycle lock) | epm_gold.budget_monthly_input | gold_spread_budget (manual monthly branch; all layers) |
| Entity Fiscal Calendar | epm_gold.entity_fiscal_calendars | silver_gl_entries (which ERP calendar an entity posts against) |
| Cash Flow Category | epm_staging.cash_flow_categories | gold_cash_flow_indirect, gold_consolidated_cash_flow (Published rows only) |
| Dimension Mapping | epm_staging.dimension_mappings | dim_harmonize_joins() in stg_gl_entries and stg_budget_entries; gold_unmapped_dimension_values |
| Reporting Hierarchy / Reporting Hierarchy Member | epm_staging.reporting_hierarchies | gold_reporting_hierarchy |
| Dimension, Measure, Fiscal Period | the konsol-managed vars block of dbt_project.yml (dimensions, base_measures, fiscal_extra_periods, fiscal_quarter_mapping, fiscal_half_mapping), regenerated by konsol.dbt_config | every model through the dimension_helpers, measure_helpers macros and gold_period_hierarchy |
| Trial Balance Submission | epm_raw.trial_balance_submissions, epm_raw.trial_balance_submission_control | bronze_trial_balance_submissions |
epm_staging.scenario_definitions (scenarios created through the API) is unioned into gold_scenario_versions for ids the doctype does not hold.
Retired tables
Dropped by konsol's migrate (_RETIRED_TABLES), never recreated: the epm_gold copies of the former seeds ic_elimination_rules and consolidation_adjustments (konsolidat#146), and every cost-allocation table in epm_gold and epm_staging (the rule table, the three driver tables, tiers, runs: konsol#264, konsolidat de468fa, 2026-09-19, cost allocation removed entirely). The epm_allocated database is dropped when empty.
Adding reference data
Do not add a CSV. Declare the data in konsol (a new doctype or a field on an existing one), add its table to konsol's _REFERENCE_TABLE_DDL and to clickhouse/init-db.sql, declare it in dbt_project/models/staging/_staging__sources.yml, and read it with {{ source('epm_staging', '<table>') }}. See Extending dbt Models.