Skip to content

Commit

Permalink
handle null state timestamps
Browse files Browse the repository at this point in the history
  • Loading branch information
prratek committed Feb 23, 2022
1 parent 87dba28 commit 11dbcac
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "tap-instagram"
version = "0.3.1"
version = "0.3.2"
description = "`tap-instagram` is a Singer tap for Instagram, built with the Meltano SDK for Singer Taps."
authors = ["Prratek Ramchandani"]
keywords = [
Expand Down
16 changes: 11 additions & 5 deletions tap_instagram/streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -482,11 +482,17 @@ def _fetch_time_based_pagination_range(
Returns: DateTime objects for "since" and "until"
"""
since = max(self.get_starting_timestamp(context), min_since)
window_end = min(
self.get_replication_key_signpost(context),
pendulum.instance(since).add(seconds=max_time_window.seconds),
)
try:
since = max(self.get_starting_timestamp(context), min_since)
window_end = min(
self.get_replication_key_signpost(context),
pendulum.instance(since).add(seconds=max_time_window.seconds),
)
# seeing cases where self.get_starting_timestamp() is null
# possibly related to target-bigquery pushing malformed state - https://gitlab.com/meltano/sdk/-/issues/300
except TypeError:
since = min_since
window_end = pendulum.instance(since).add(seconds=max_time_window.seconds)
until = min(window_end, max_until)
return since, until

Expand Down

0 comments on commit 11dbcac

Please sign in to comment.