Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

not write partitions to state, fix get_starting_time #28

Merged
merged 1 commit into from
Oct 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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))
Loading