Good morning (UK here) What is the recommended wa...
# troubleshooting
i
Good morning (UK here) What is the recommended way of implementing incremental replication where the tables have a UUID field as
id
? I see that the query is modified with
ORDER BY id
which makes no sense with UUIDs so can I specify a compound field of
created_at
with
updated_at
or even some custom SQL like
COALESCE(updated_at, created_at)
? I'm referring to the
replication-key
property
Copy code
metadata:
  <table>:
    replication-key: <value>
Edit: The reason for this question is because the application design is so poor that the
updated_at
field is not always set when a row is created. This is why the coalesce statement is used to get the latest version of a row. Hence my question 🙂
s
How about log-based replication? We would prefer that usually over key based for incremental. That way you leverage the source to determine the change sets.
a
One way if you are able, define a view on the db that does the coalescing of created & updated, and then select from that view? But guessing if you have this issue on one table, you will have it elsewhere...
i
Thanks @Sven Balnojan I will be trying that next. I'm working my way through the replication methods to get an understanding of limitations and strengths as I get to know Meltano (one week in so far)
Thanks @Andy Carter your solution is definitely an option, not a preferred one but somewhere on the list. You are of course completely correct that the modelling of the tables in the schema I'm working with is suboptimal.
Thanks again @Sven Balnojan I have now tried out the log based replication to S3, it works nicely. Next step... S3 incremental logs to Redshift
p
I've seen other questions related to this but cant find them at the moment. You can use stream maps to coalesce 2 fields after theyve been extracted like I do here but that would only really help with deduping and would still require extracting the data from the source each time. I've heard similar requests enough times for it to at least deserve a feature request issue in the SDK
Oh looks like I found an existing one https://github.com/meltano/sdk/issues/1422 that links to a relevant conversation in https://meltano.slack.com/archives/C01PKLU5D1R/p1676351256072409
i
Awesome @pat_nadolny thank you!