Skip to content

Commit

Permalink
not write partitions to state, fix get_starting_time (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
keyn4 authored Oct 16, 2024
1 parent f434ac8 commit 622e9b0
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions tap_restaurant365/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
from singer_sdk.pagination import BaseAPIPaginator # noqa: TCH002
from singer_sdk.streams import RESTStream

import singer_sdk._singerlib as singer

_Auth = Callable[[requests.PreparedRequest], requests.PreparedRequest]


Expand Down Expand Up @@ -74,8 +76,9 @@ def get_starting_time(self, context):
rep_key = None
if start_date:
start_date = parser.parse(self.config.get("start_date"))
if context:
rep_key = self.get_starting_timestamp(context) + timedelta(seconds=1)
rep_key = self.get_starting_timestamp(context)
if rep_key:
rep_key = rep_key + timedelta(seconds=1)
return rep_key or start_date

def get_url_params(
Expand Down Expand Up @@ -137,3 +140,14 @@ def backoff_max_tries(self) -> int:
Number of max retries.
"""
return 8

def _write_state_message(self) -> None:
"""Write out a STATE message with the latest state."""
tap_state = self.tap_state

if tap_state and tap_state.get("bookmarks"):
for stream_name in tap_state.get("bookmarks").keys():
if tap_state["bookmarks"][stream_name].get("partitions") and stream_name in ["transaction_detail"]:
tap_state["bookmarks"][stream_name] = {"partitions": []}

singer.write_message(singer.StateMessage(value=tap_state))

0 comments on commit 622e9b0

Please sign in to comment.