Hello, I’m pretty new to Singer. Are there any wor...
# singer-tap-development
j
Hello, I’m pretty new to Singer. Are there any working examples of how to use state.json? I’ve set the replication key to the page value of a query as a test. I capture state from the output and write it to state.json. However, when using
--state state.json
the code seems to always perform a full table replication. I’m unclear if the bookmarking state logic is built in, or if I need to implement it in sync() as I’m seeing with a lot of the existing metlano-optimized taps.
e
Hi @john_hwang! Are you using the SDK?
j
Yes I am using the SDK.
Here is my state.json
Copy code
{
  "bookmarks": {
    "rule_key": {
      "replication_key": "p",
      "replication_key_value": 25
    }
  }
}
When running the tap with this state passed in, I still see output records where “p” has values of 1 or 2 for example.
e
j
I was not, thanks for the advice. As suggested, I used
get_starting_replication_key_value
inside get_url_params, and print the results of the function. I get the expected replication_key_value of 25.
e
Nice!
j
It’s a relief to know that my state.json is at least being read in correctly. But isn’t the incremental update process supposed to automatically skip queries with lower replication_key values? Why is it still emitting records for pages 1-24?
Since state.json is being properly read, and the replication key value is correct, I’m assuming I just have to manually implement the incremental replication? https://meltano.slack.com/archives/C01PKLU5D1R/p1651072589470159?thread_ts=1650984084.570929&cid=C01PKLU5D1R
Also, if it’s relevant, I’m running the tap using poetry rather than using meltano run or meltano elt.
e
I’m assuming I just have to manually implement the incremental replication?
That is correct. It's up to the dev to implement the actual filtering that the source system expects 👍
Also, if it’s relevant, I’m running the tap using poetry rather than using meltano run or meltano elt.
Yup, that should be alright.
j
Ok thanks for the feedback!
e
Let me know if you get stuck 🙂