Capturing Delta Changes in Your Local Table (File)

Enable Delta Capture in your local table (file) to automatically track all inserts, updates, and deletions of its records via Change Date and Change Type columns. You can use replication flows and transformation flows to write to these tables and to read from them, extracting only delta changes for each run.

Prerequisites

To enable Delta Capture:
  • Your table must have the status Not Deployed.

  • You must define one or more key columns.

Switching Delta Capture On

Local tables (files) can be used as source data or target data by SAP Datasphere apps. For some business scenarios, you might need to keep an eye on changes that will be made after you have deployed your local table (file). For example, after you run a merge task or a transformation flow, you might want to know which data is updated or deleted. When creating a local table (file), you can switch on a toggle that will capture the future updates made in your table.

In a local table (file), the data is stored in a Delta Lake table in the SAP HANA Data Lake Files storage. The columnar parquet files in the table's directory belong to different versions of the data. If delta capture is switched on, versions are tracked in a folder "_delta_log", which allows for time travel to historic data versions. Every 10 versions, a checkpoint file is stored in this folder, which represents a full snapshot of the version. Those checkpoint files are required to load the data changes in this version and the subsequent 9 versions for which no checkpoint file is created.

You enable Delta Capture while creating a local table. See Creating a Local Table (File).

When Delta Capture is switched on:
  • Delta Capture Table field is added and a default name for the delta capture table is defined (Technical name + Delta).

  • 2 additional columns are automatically created in my table:

    Column Description Possible Values

    Change Date

    The column will track the last date and time of the last change to an individual record.

    Current UTC timestamp.

    Change Type

    This column will track the type of last change made to a record.

    This column will track the type of last change made to a record.When a record is inserted or updated corresponding change types are used: "I" for insert (a new record is added), "U" for update (an existing record gets an updated value). When an existing record is deleted other specific change types are used (for example "D"). Note that deleting a record will not physically delete it, so that the changes can be propagated to the different objects that consume it in delta mode. It is however filtered out when accessing the Local Table (using the Active Records Table). For more information on records deletion, see Deleting Local Table (File) Records

You can change both the business name and technical name, but you can't change the data type (read-only).

Log Retention Period and Prompt Processing of Changes

The log retention time in the SAP HANA Data Lake Files storage is 30 days. Checkpoint files that are older than 30 days are automatically cleaned up when a new version is created. Make sure to process data changes in a flow before the required checkpoint files get deleted. As a best practice, we recommend not letting more than 3 days between a merge task and a flow run.

Deployment and Consumption of Local Table (File) With Delta Capture

When a local table (file) with delta capture is deployed, the following objects are created and stored in the repository:
  • The table that contains the delta capture columns. The technical name ends with "Delta".

  • The table that contains only the active records. It excludes both the delta capture columns and the historical data versions.

The 2 objects are consumed differently by SAP Datasphere apps: