Hi all, How to insert/update data into a scd type ...
# troubleshooting
h
Hi all, How to insert/update data into a scd type 2 table using flink streaming (Table API SQL). Example with CARD table. - At
2024-10-15 01:00:00
, the first record of Token1
TOKEN_ID STATUS_ID      EFF_DATE        EXP_DATE
Token1       1      2024-10-15 01:00:00    null
- At
2024-10-15 08:00:00
, the STATUS_ID Token1 is updated to 2, the expected data:
TOKEN_ID STATUS_ID       EFF_DATE          EXP_DATE
Token1      1      2024-10-15 01:00:00 2024-10-15 08:00:00
Token1      2      2024-10-15 08:00:00      null
At
2024-10-15 08:00:00
, two operations need to be performed: update the record with EXP_DATE is null and insert new record with STATUS_ID is 2 into scd type 2 table. Here only update record with EXP_DATE is null, for example - At
2024-10-15 09:00:00
, STATUS_ID of Token1 updated to 1, expected data:
TOKEN_ID STATUS_ID      EFF_DATE           EXP_DATE
Token1      1      2024-10-15 01:00:00 2024-10-15 08:00:00
Token1      2      2024-10-15 08:00:00 2024-10-15 09:00:00
Token1      1      2024-10-15 09:00:00       null
Do you have any solution?. Let me know and discuss. Thanks.