Hello everyone, I'm developing a target connector ...
# meltano-plugin-development
m
Hello everyone, I'm developing a target connector with the SDK and I need to add some specific logic when it's called with the full-refresh parameter. Is there any method that I should override for this purpose?
r
--full-refresh
is a Meltano construct that just means run without state. Not sure how you would detect this in a target. Can you be more specific with what you are you trying to do?
m
Hi @Reuben (Matatika), I need to FLUSHALL records in a redis db before sending new batches there.
r
I think you would have to implement it as a setting like
hard_delete
, which is a pattern a couple other targets follow. In the long-term, I think you would probably be interested in the
ACTIVATE_VERSION
Singer message, which you would be able to handle in your target to process. A tap would be responsible for emitting this initially though, so it wouldn't work properly until they also add support. https://github.com/meltano/sdk/issues/18
1
m
Thank you @Reuben (Matatika)! In my implementation I use
process_batch
from the BatchSink class to define logic how to push data to the destination. It's still not clear to me and I could find any examples where should I define a custom logic for the
hard_delete
setting. As I understand I cannot place it in
process_batch
as it's going to be executed multiple times.
np 1
probably I just should add it to the
__init__
method
r
If you can control flushing of specific records and you have a 1:1 or many:1 stream to sink mapping configured,
Sink.start_drain
could work. Otherwise yeah, something like
__init__
.
🙌 1