Reuse history supplied by a source
On this page
Source is historicised tells the historization generator that the input already contains dated versions. It is different from generating historical JOINs in a Transformation, and it is not a request to copy source surrogate keys unchanged.
Enable the mode
A nonempty ValidFrom existing keys expression is required. Save retains the flag only when that expression is present. The generator disables source-history reuse if Insert only (no PK) is also enabled. Keep those configurations separate.
The generator uses the existing-key start expression as the initial/new-key expression when the latter is blank. Optional ValidTo supplies source end dates. Review expressions against the source columns and generated SQL before execution.
Truncate historized table is retained only with source-history reuse. It removes destination history before loading; it also causes the subsequent no-open-history initial-load path to be taken.
Period boundaries confirmed by the owner
When source end dates are not supplied, the end of each version is derived from the next version's ValidFrom. Depending on the validity setting, it equals that next start or is three milliseconds earlier. The final version ends at 99991231. This applies to initial loading and truncate/reload as well as subsequent loading.
The owner reports a successful test of this behavior. An earlier static review suspected that an initial-load shortcut could leave multiple versions open; that suspicion has not been reproduced and is not an established defect. The documentation author has not independently executed the owner's test.
Source-period construction
The inspected interval-building branch partitions incoming versions by PK and orders them by the source start expression.
- Without ValidTo, it derives each end from the next start using LEAD, with
99991231for the final version. - The inspected SQL interval fragment uses a two-millisecond adjustment in inclusive mode; the owner describes the effective datetime boundary as three milliseconds before the next start. Verify the generated expression and datatype when reviewing exact precision. Half-open mode uses the next start directly.
- With ValidTo, the generated CASE limits the supplied end to the next-start boundary when the supplied end is later. It is not unconditional preservation of the supplied interval.
- The existing destination candidate is selected by the maximum ValidTo per key. A ROW_NUMBER assignment ties the first incoming candidate to its existing surrogate key; subsequent candidates can become new versions.
- Further updates close/adjust the existing interval, and insertion requires a positive period (
ValidFrom < derived end).
Rows tied on source start dates or destination maximum end dates need explicit testing: the inspected ordering does not provide a general business rule for resolving conflicting versions.
Interaction with other options
| Setting | Reuse behavior |
|---|---|
| Per-column SCD policy | The generator forces the reviewed column path to SCD2 while reusing source history; do not assume normal SCD0/SCD1 change rules remain active. |
| Check source for duplicates | The ordinary duplicate guard is generated only outside source-history reuse. Multiple versions per business key are not equivalent to invalid identical time periods. |
| Delete future history if it exists | The normal future-history cleanup is skipped in this mode. |
| Technical dates | Insert/close fragments still use processing timestamps where configured; they do not prove an immutable audit archive. |
| Missing-record policy | Missing-record handling remains a separate branch; review it with source completeness and date expressions. |
| Source/history filters | Their placement differs across initial, reuse and absence-detection branches. Inspect the emitted procedure; do not assume one filter uniformly qualifies every subquery. |
Validation scenario
Use one synthetic business key with three nonoverlapping source periods, plus an unrelated key. Check these runs independently from restored fixtures:
- Empty destination with explicit source end dates.
- Empty destination without end dates.
- Existing destination with at least one open row; supply a later version for an existing key and versions for a new key.
- Nonempty destination containing only closed rows.
- Truncate/reload, equal start timestamps, gaps and overlapping source periods.
- Inclusive and half-open validity, with technical/chain columns if configured.
Compare actual periods, attributes and surrogate keys, not just row counts. These scenarios have not been independently executed during documentation authoring; the owner reports that the first-load period test passed.
See historization configuration, technical validity and future-history corrections.