hello_dev
07/09/2022, 12:36 PMstate? I don't know what to do when customizing the taphello_dev
07/11/2022, 2:14 AMvisch
07/11/2022, 2:38 AMvisch
07/11/2022, 2:39 AMhello_dev
07/11/2022, 2:58 AMedgar_ramirez_mondragon
07/11/2022, 11:18 AMhello_dev
07/11/2022, 12:52 PMedgar_ramirez_mondragon
07/11/2022, 12:54 PMhello_dev
07/11/2022, 12:58 PMstate=self.get_context_state()
state = singer.write_bookmark(state,
'log',
'last_time', toTime
)
# should save state,but i don't know how to doedgar_ramirez_mondragon
07/11/2022, 1:05 PMsinger.write_bookmark , and that would only write it to stdout, not save it. Does you stream declare a replication_key?hello_dev
07/11/2022, 1:24 PMself.replication_key=[str(toTime)] ,but failhello_dev
07/12/2022, 12:15 PMelt command is used, and state.json cannot be generated, and state cannot be inserted using the run command
class LogStream(SlsStream):
"""Define custom stream."""
primary_keys = ["time"]
replication_key = 'time'edgar_ramirez_mondragon
07/12/2022, 4:23 PMelt and run will generate the state JSON object and store it in its system db (sqlite by default).aaronsteers
07/18/2022, 8:07 PMreplication_key is set in the stream, the SDK will track state on that key automatically and the state bookmarks will automatically be sent to your target. (If using Meltano, the state is stored in an artifact linked to state_id which is automatic when using meltano run or driven by --state-id in other cases.) The target will write out the state artifact to STDOUT once it has processed all records up to that point.
Use state on the next run(s): Again, if using Meltano and a valid state ID (either explicitly or via auto-generated IDs from meltano run) the state will be loaded automatically using the --state CLI arg, and you just need to make sure you send the latest bookmarks from get_starting_timestamp() into get_url_params() .
Basically, as long as you have replication_key defined and you are passing its value back to your API, the rest should be automatic.
Does this help?