> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nekt.com/llms.txt
> Use this file to discover all available pages before exploring further.

# History

> Track historical changes in your data over time with a no-code SCD Type 2 implementation.

The History module lets you create a complete history of any table using a no-code SCD Type 2 template.

Unlike Type 1 (which overwrites old data) or Type 3 (which stores limited history), the History module automatically creates new records for each change — making it perfect for tracking changes in customer information, product details, or employee records over time.

<video src="https://public.nekt.ai/videos/transformations/scd-type-2.mp4" autoPlay muted loop playsInline preload="auto" className="w-full" />

### Creating a History

<Steps>
  <Step title="Select input table">
    Choose the source table containing the data you want to version. Make sure the table has a reliable way to detect changes.
  </Step>

  <Step title="Define primary keys">
    Specify the business keys that uniquely identify each record (e.g., `customer_id`, `product_id`). Nekt automatically creates a surrogate key for versioning.
  </Step>

  <Step title="Configure output settings">
    Select the output layer, name the history table, and set the run schedule. Choose from schedule-based, event-based, or manual triggers. See [Triggers documentation](/runs/scheduling-and-triggers) for details.
  </Step>
</Steps>

### Best Practices

<Note>
  Choose primary keys that are stable and will not change over the lifetime of a record. Changing primary keys mid-stream causes incorrect version boundaries and corrupts the historical chain.
</Note>

Document the business rules that determine what counts as a meaningful change for each History. This context is easy to lose and hard to reconstruct later.

Monitor storage growth and the number of changes detected per run. A sudden spike usually indicates an upstream data issue rather than genuine business activity.

### Need Help?

Review the [SCD Type 2 use case](/use-cases/scd-type2) for a practical end-to-end example.

### Use Cases

<CardGroup cols={2}>
  <Card title="Customer churn prediction" icon="chart-line-down">
    ML models need versioned behavior history — plan downgrades, engagement drops — not just today's snapshot. History provides that automatically without custom pipelines.
  </Card>

  <Card title="Lead scoring" icon="bullseye-arrow">
    CRM records change constantly. Versioned snapshots let scoring models understand when a lead's profile improved or degraded over time, improving model accuracy.
  </Card>

  <Card title="Point-in-time context for LLMs" icon="clock-rotate-left">
    RAG pipelines and AI agents often need to know what was true at a specific moment. History makes it possible to reconstruct the state of any record at any point in time.
  </Card>

  <Card title="Feature drift & anomaly detection" icon="wave-pulse">
    ML monitoring compares current feature values against historical baselines. History creates and maintains those baselines without custom code.
  </Card>
</CardGroup>
