Michael Bi
11/16/2025, 9:52 PMtarget-redshift ticketswap variant plugin's behavior when setting the load_method config parameter in the meltano.yml file.
I know that we have three option as described below:
The method to use when loading data into the destination. append-only will always write all input records whether that records already exists or not. upsert will update existing records and insert new records. overwrite will delete all existing records and insert all input records.
*However, it seems that target-redshift will always upsert the records no matter what I set the value to, e.g., append-only results in an upsert*; I've been verifying the constant upsert behavior by checking the record counts and by confirming that some of the records have updated_at times that are at the time of the newest etl run while others do not have the updated_at timestamp updated. I haven't set the TARGET_REDSHIFT_LOAD_METHOD env var anywhere, so it's not clear to me what's resulting in this unexpected behavior.
I have tested the following scenarios, all resulting in upserts:
1. Deleting the etl-specific bookmarking data in the meltano backend db
2. Updating the etl-specific bookmarking data in the meltano backend db to 0
3. Running the etl pipeline with the --full-refresh flag
4. Running the etl pipeline with the bookmarking data deleted without emptying the target redshift table, which in theory should result in double the records, but instead results in the same number of records as before the run
a. "initial_full_table_complete": true <-- this shows up when running etl pipeline for the first time after deleting bookmarking data
On a related note, within the logs, does the "merging" language imply that an upsert is always occurring, or is it generically referring to the fact that records are being injected into the Redshift tables and has no bearing on what type of update is occurring (e.g., append-only, overwrite, upsert)? I ask because I've tried running the etl pipeline with overwrite and upsert load_method settings and the logs appear the same, which doesn't give me much insight into what behavior is actually occuring.
merging 13075 records into meltano_stitch_replacement_poc.sales_invoice
Any tips would be appreciated--thank you!Andy Carter
11/17/2025, 9:04 AM'merging' in the code. If you follow that through, it looks like having a PK or not determines append or upsert behaviour,
https://github.com/TicketSwap/target-redshift/blob/main/target_redshift/sinks.py#L138
https://github.com/TicketSwap/target-redshift/blob/main/target_redshift/sinks.py#L215
Perhaps if you have primary keys defined on the stream, you need to remove them to get append behaviour?Holly Evans
11/17/2025, 3:45 PMload_method. it also does not do overwrite, i had to fork to add that. It is correct that append_only vs upsert is determined by whether key_properties is set on a streamMichael Bi
11/19/2025, 5:32 AMload_method is described as a toggle-able feature in the target docs but doesn't actually work in reality.Michael Bi
11/19/2025, 7:10 AMMichael Bi
11/19/2025, 7:11 AM"stream": "sales_order",
"metadata": [
{
"breadcrumb": [],
"metadata": {
"selected-by-default": false,
"database-name": "xxxxx",
"is-view": false,
"table-key-properties": [
"entity_id"
],
"selected": true,
"replication-method": "INCREMENTAL",
"replication-key": "entity_id"
}
},
The catalog for this stream originally looked like the above, and then I deleted the three aforementioned key-value pairsAndy Carter
11/19/2025, 8:51 AMinvoke your tap and see if the schema definition in the json matches expected for primary keys i.e. None.Michael Bi
11/19/2025, 11:22 PMMichael Bi
11/20/2025, 12:11 AM--full-refresh runs subsequently. Deleting the table did remove the entity_id field from the table's sort key but it's still being defined as the distribution key (not sure if that's potentially causing the issue.Andy Carter
11/20/2025, 9:06 AMThe custom catalog I have defined that doesn't have the keys is defined for the redshift target.
@Michael Bi Perhaps @Edgar Ramírez (Arch.dev) can confirm but I thought catalogs only apply to taps? That might explain the issue.Michael Bi
11/21/2025, 12:19 AMMichael Bi
11/21/2025, 12:20 AMupsert issue:
1. table-key-properties
2. replication-method
3. replication-keyHolly Evans
11/21/2025, 12:31 AMinvoke advice is still helpful. check the schema message that comes from invoking your tap to make sure you're not getting any key propertiesHolly Evans
11/21/2025, 12:31 AMMichael Bi
11/23/2025, 3:29 AM