Skip to main content

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_trash hook calls clickhouse.sync_doctype(), which TRUNCATE + 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 after bench migrate and stamps each with one reconcile_run_id.
  • Every successful sync stamps epm_staging.sync_watermark; assert_staging_not_stale fails 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.sql on a fresh volume; the two are kept identical by tests in both repos).

Doctype to table​

konsol doctypeClickHouse tableRead by
Main Accountepm_staging.main_accountssilver_main_accounts (its only source; fx_method decides the translation rate, is_retained_earnings the close account)
Entityepm_staging.entitiessilver_entity_currencies; the deal journals
EPM Fiscal Year / EPM Fiscal Year Periodepm_staging.fiscal_periodssilver_tb_movements (Closing period), rate_period_map(), the hierarchy roll-ups, the deal journals
Group Exchange Rateepm_staging.group_exchange_ratesgold_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 Rateepm_staging.historical_equity_ratesgold_consolidated_trial_balance (accounts whose fx_method = 'historical')
ISO Currencyepm_gold.currenciesFX validation and the magnitude check (usd_log10) in governed_rate_gaps()
Consolidation Groupepm_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 Periodepm_staging.ownership_periodsgold_entity_ownership (via ownership_resolution_ctes()), gold_acquisition_adjustments
Intercompany Accountepm_staging.intercompany_accountsic_account_map() → gold_ic_reconciliation, gold_ic_eliminations, gold_ic_unmatched
IC Elimination Ruleepm_staging.ic_elimination_rulesgold_ic_eliminations (only rule_type = 'unrealized_profit' still eliminates anything)
IC Balanceepm_staging.ic_balancesgold_ic_eliminations (unrealised profit)
Consolidation Journalepm_staging.consolidation_adjustmentsgold_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, ..._costsgold_business_combination_journal, gold_goodwill_amortisation_journal
Business Disposal (+ Proceeds child)epm_staging.business_disposals, business_disposal_proceedsgold_business_disposal_journal, gold_goodwill_amortisation_journal (the schedule stops at disposal)
Scenarioepm_gold.scenario_definitionsgold_scenario_versions, gold_scenario_trial_balance, the three variance models (which scenario is actual, which are budgets: scenario_type)
Spread Profileepm_gold.spread_profilesgold_spread_budget
Budget Annual Inputepm_gold.budget_annual_inputgold_spread_budget (annual spread branch)
Budget Sheet (on cycle lock)epm_gold.budget_monthly_inputgold_spread_budget (manual monthly branch; all layers)
Entity Fiscal Calendarepm_gold.entity_fiscal_calendarssilver_gl_entries (which ERP calendar an entity posts against)
Cash Flow Categoryepm_staging.cash_flow_categoriesgold_cash_flow_indirect, gold_consolidated_cash_flow (Published rows only)
Dimension Mappingepm_staging.dimension_mappingsdim_harmonize_joins() in stg_gl_entries and stg_budget_entries; gold_unmapped_dimension_values
Reporting Hierarchy / Reporting Hierarchy Memberepm_staging.reporting_hierarchiesgold_reporting_hierarchy
Dimension, Measure, Fiscal Periodthe konsol-managed vars block of dbt_project.yml (dimensions, base_measures, fiscal_extra_periods, fiscal_quarter_mapping, fiscal_half_mapping), regenerated by konsol.dbt_configevery model through the dimension_helpers, measure_helpers macros and gold_period_hierarchy
Trial Balance Submissionepm_raw.trial_balance_submissions, epm_raw.trial_balance_submission_controlbronze_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.