mathieu_hinderyckx
01/13/2023, 4:47 PMThe SDK was designed to automatically handle the *state* implementations so that developers don't have to. I don't get what is meant by that. How can we define which state must be kept, and/or what state is kept by default? I would like to manually update the state, as I need to do something similar as described here. Do I need to set replication_key and/or replication_key_value for this? What I hope to achieve is to update a timestamp in the state everytime I have processed one of the 'bins' in a timerange, as described in the linked slack post. I have overridden get_next_page_token to calculate the required parameters, but I don't know how I can update the state now after a batch/bin is finished.aaronsteers
01/13/2023, 6:31 PMreplication_key to the name of your datetime field. Optionally, you can also set is_sorted=True in cases where you know and trust 100% that your data will come pre-sorted.aaronsteers
01/13/2023, 6:34 PMWhat I hope to achieve is to update a timestamp in the state everytime I have processed one of the 'bins' in a timerange, as described in the linked slack post.It might be helpful if I could better understand the use case. 1. Do you get the data emitted from the source in pre-sorted order? 2. Is there anything you want to put into state besides the max value seen so far? 3. Do the 'bins' differ meaningfully from the value of the incremental key, or are they just the outer loop of the same?
mathieu_hinderyckx
01/17/2023, 9:28 AMaaronsteers
01/17/2023, 6:05 PMThe state should thus be a combination of (daterange_start, page).Won't the page be volatile, and likely change on next run though if you start from a different start time/datestamp?
aaronsteers
01/17/2023, 6:06 PMA single value for replication_key / incremental key (so in this case that would be the start of the daterange I suppose) is thus not enough to know where I am in the stream: I need to also know within the daterange on which page I am.I guess I don't follow this point, and maybe I'm missing something about the application. If the latest timestamp is 'Jan 17 10:06am', wouldn't that be enough to calculate the new 'bins' or dateranges? (i.e. 'Jan 17 10:106am' would go into a bin like 'Jan 17 full day' or 'Week starting Jan 15')