Denis I.
10/21/2023, 10:24 AMtruncate
events from source tables in postgres
(or other dbms’)?
It’s possible to detect the event with LOG_BASED
replication method. I’ve researched two taps from MeltanoLab and Transferwise:
• Meltano variant detects truncate event and issues debug log message
• Transferwise variant ignores truncate event and do nothing
The first idea that comes up is to patch both tap/target to send and receive a special type message and process it accordingly, but it seems too hacky.
Anyone has experience in the field?visch
10/21/2023, 12:38 PMDenis I.
10/21/2023, 1:37 PMvisch
10/21/2023, 2:42 PMDenis I.
10/25/2023, 9:16 AMTRUNCATE
events with a simple approach: when the event received the target flushes all prior collected upserts to table and then updates all rows’ sdc_deleted_at
with timestamp WHERE sdc_deleted_at IS NOT NULL
.
It simply does the trick, but feels too hacky for original use case of ACTIVATE_VERSION
.
Digging deeper I’ve found how other tap/target variants do it:
1. Rename old table with postfix and create a new one
2. Add version column and soft/hard delete rows of previously active version
I like the second one, it feels more straightforward to keep everything in one table.