02-06-2025 11:46 AM - edited 02-06-2025 12:30 PM
Incremental data loads in Incorta insert new records and update existing ones, but they don't automatically delete records when they're removed from the source system (like Oracle Cloud ERP). Since source systems often allow data deletion, this can lead to discrepancies where records deleted at the source still exist in Incorta. However, Incorta provides ways to manage these deleted source records.
One such method is the Data Purge feature, introduced in version 2024.7.x. Data Purge removes unnecessary data from physical tables or materialized views, improving performance and disk space utilization. It works by creating an exclusion set that identifies the records deleted from the source system. This exclusion set is then compared against the corresponding table in Incorta. A purge job is then executed, physically deleting the identified records from both the parquet files (storage) and memory. Refer to the Incorta Doc for information on Data Purge
Step 1: For each table that needs delete handling, the first step is to create a corresponding skinny table that contains only the primary key column(s) for the table and that is always loaded in full. It is recommended that these tables be placed into a separate schema whose only purpose is to hold these types of tables.
Step 2: The second step is to create a Materialized View (MV) that will compare the PK table against the base table to create the exclusion set which represents the records that have been deleted in the source table. The MV can be placed in the schema with the PK table. Here is an example of the MV code you would write to create the table that holds your exclusion set.
SELECT I.INVOICE_ID
FROM FUSION_AP.AP_INVOICES_ALL I
ANTI JOIN PK_SCHEMA.AP_INVOICES_ALL_PK P
ON I.INVOICE_ID = P.INVOICE_ID
Next, configure your base table to use the exclusion set table that you have created by opening the Advanced settings tab.
Toggle on the Synchronizing delete operations option and select the exclusion set identifier schema and table.
Define the column mappings between the target table and the exclusion set and save.
Step 3: The next step to delete records from Incorta is to run a purge job. This can be run table by table as needed or can be scheduled from a separate Load Plan with Data purge option. The purge job will remove records from Incorta .