Physically delete¶
If you want to remove records from the logical validation layer (LVL) and the central facts layer (CFL), you can select the option physical delete to ensure data will be deleted without compromising the referential integrity of the database.
How it works¶
Selecting the physical delete option is similar to a logical delete, but:
- In the Logical Validation Layer, the deleted records are completely removed from the database
- In the Central Facts Layer:
- the deleted rows from a Context (normal, bi-temporal) are completely removed from the database
- the deleted rows from Dependent (Links) and Independent (Anchors) entities are flagged as 'physically deleted' by changing the value of the column
acm_physically_removed_indfrom0to1and populating the columnacm_physically_removed_by.
How to physically delete data¶
Example¶
In the following example, the dataset is a batch delivery where the entities are delivered in full.
There are four customers in the first dataset. In the next dataset, customer nbr 4 is not delivered anymore. What will happen if you remove this record with the physical delete option from the i-refactory engine?
LVL
Before the physical delete you see 4 customers.
| nbr | name | address | nation_nbr | phone_nbr | account_balance | market_segment | comment | acm_source_transaction_ind | acm_start_dt | acm_end_dt | acm_audit_id | acm_record_ind | acm_rownumber | acm_entity_id |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | Joep Lutterveld | Gerritweg 22 | 1 | 024-2542634 | 914.16 | FURNITURE | NULL | NULL | 2023-02-16 16:01:41.7140000 | NULL | 989 | N | 1 | 285 |
| 2 | Frederique Bakker | Markbaan 71 | 1 | 0283 621751 | 68.50 | HOUSEHOLD | NULL | NULL | 2023-02-16 16:01:41.7140000 | NULL | 989 | N | 2 | 285 |
| 3 | Sterre Hexspoor | Vigostraat 31 | 1 | 050 4047917 | 6755.50 | HOUSEHOLD | NULL | NULL | 2023-02-16 16:01:41.7140000 | NULL | 989 | N | 3 | 285 |
After the physical delete of customer number 4, you can only see 3 customers.
| nbr | name | address | nation_nbr | phone_nbr | account_balance | market_segment | comment | acm_source_transaction_ind | acm_start_dt | acm_end_dt | acm_audit_id | acm_record_ind | acm_rownumber | acm_entity_id |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | Joep Lutterveld | Gerritweg 22 | 1 | 024-2542634 | 914.16 | FURNITURE | NULL | NULL | 2023-02-16 16:01:41.7140000 | NULL | 989 | N | 1 | 285 |
| 2 | Frederique Bakker | Markbaan 71 | 1 | 0283 621751 | 68.50 | HOUSEHOLD | NULL | NULL | 2023-02-16 16:01:41.7140000 | NULL | 989 | N | 2 | 285 |
| 3 | Sterre Hexspoor | Vigostraat 31 | 1 | 050 4047917 | 6755.50 | HOUSEHOLD | NULL | NULL | 2023-02-16 16:01:41.7140000 | NULL | 989 | N | 3 | 285 |
CPL
Anchor before the physical delete
| id | nbr | acm_audit_id | acm_entity_id | acm_exists_ind | acm_latest_start_dt | acm_last_created_dt | acm_physically_removed_ind | acm_physically_removed_by |
|---|---|---|---|---|---|---|---|---|
| 1 | 1 | 945 | 233 | 1 | 2023-02-16 16:01:41.7140000 | 2023-02-16 16:01:41.7140000 | 0 | NULL |
| 2 | 2 | 945 | 233 | 1 | 2023-02-16 16:01:41.7140000 | 2023-02-16 16:01:41.7140000 | 0 | NULL |
| 3 | 3 | 945 | 233 | 1 | 2023-02-16 16:01:41.7140000 | 2023-02-16 16:01:41.7140000 | 0 | NULL |
| 4 | 4 | 1155 | 233 | 1 | 2023-03-02 10:55:26.0180000 | 2023-03-02 10:55:26.0180000 | 0 | NULL |
In the Anchor after the physical delete. The business key of customer nbr 4 is still in the Anchor, flagged as physically deleted by acm_physically_removed_ind = 1, acm_physically_removed_by = TPCH, and acm_exist_ind = 0
| id | nbr | acm_audit_id | acm_entity_id | acm_exists_ind | acm_latest_start_dt | acm_last_created_dt | acm_physically_removed_ind | acm_physically_removed_by |
|---|---|---|---|---|---|---|---|---|
| 1 | 1 | 945 | 233 | 1 | 2023-02-16 16:01:41.7140000 | 2023-02-16 16:01:41.7140000 | 0 | NULL |
| 2 | 2 | 945 | 233 | 1 | 2023-02-16 16:01:41.7140000 | 2023-02-16 16:01:41.7140000 | 0 | NULL |
| 3 | 3 | 945 | 233 | 1 | 2023-02-16 16:01:41.7140000 | 2023-02-16 16:01:41.7140000 | 0 | NULL |
| 4 | 4 | 1680 | 233 | 0 | 2023-03-02 11:24:22.9720000 | 2023-03-02 11:15:50.3730000 | 1 | TPCH |
Context before the physical delete
| id | acm_start_dt | acm_end_dt | name | address | phone_nbr | account_balance | market_segment | comment | h_nation_id | acm_audit_id | acm_entity_id | acm_record_ind | acm_missing_ind | acm_source_transaction_ind | acm_source_key_transaction_ind | acm_modifier_id |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | 2023-02-16 16:01:41.7140000 | 8900-12-31 00:00:00.0000000 | Joep Lutterveld | Gerritweg 22 | 024-2542634 | 914.16 | FURNITURE | NULL | 1 | 946 | 235 | N | NULL | NULL | NULL | TPCH |
| 2 | 2023-02-16 16:01:41.7140000 | 8900-12-31 00:00:00.0000000 | Frederique Bakker | Markbaan 71 | 0283 621751 | 68.50 | HOUSEHOLD | NULL | 1 | 946 | 235 | N | NULL | NULL | NULL | TPCH |
| 3 | 2023-02-16 16:01:41.7140000 | 8900-12-31 00:00:00.0000000 | Sterre Hexspoor | Vigostraat 31 | 050 4047917 | 6755.50 | HOUSEHOLD | NULL | 1 | 946 | 235 | N | NULL | NULL | NULL | TPCH |
| 4 | 2023-03-02 10:55:26.0180000 | 8900-12-31 00:00:00.0000000 | Benjamin Boehm | Grolmanstraße 48 | 0421 434651 | 15.00 | FURNITURE | NULL | 2 | 1156 | 235 | N | NULL | NULL | NULL | TPCH |
Context after the physical delete. You can see that customer nbr 4 is removed from the Context.
| id | nbr | acm_audit_id | acm_entity_id | acm_exists_ind | acm_latest_start_dt | acm_last_created_dt | acm_physically_removed_ind | acm_physically_removed_by |
|---|---|---|---|---|---|---|---|---|
| 1 | 1 | 945 | 233 | 1 | 2023-02-16 16:01:41.7140000 | 2023-02-16 16:01:41.7140000 | 0 | NULL |
| 2 | 2 | 945 | 233 | 1 | 2023-02-16 16:01:41.7140000 | 2023-02-16 16:01:41.7140000 | 0 | NULL |
| 3 | 3 | 945 | 233 | 1 | 2023-02-16 16:01:41.7140000 | 2023-02-16 16:01:41.7140000 | 0 | NULL |
| 4 | 4 | 1680 | 233 | 0 | 2023-03-02 11:24:22.9720000 | 2023-03-02 11:15:50.3730000 | 1 | TPCH |
