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

use sync start time to bookmark contacts stream #226

Merged
merged 3 commits into from
Apr 26, 2023
Merged
Changes from 1 commit
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
3 changes: 2 additions & 1 deletion tap_hubspot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,7 @@ def sync_contacts(STATE, ctx):
# Dict to store replication key value for each contact record
bookmark_values = {}
with Transformer(UNIX_MILLISECONDS_INTEGER_DATETIME_PARSING) as bumble_bee:
sync_start_time = utils.now()
for row in gen_request(STATE, 'contacts', url, default_contact_params, 'contacts', 'has-more', ['vid-offset'], ['vidOffset']):
modified_time = None
if bookmark_key in row:
Expand All @@ -540,7 +541,7 @@ def sync_contacts(STATE, ctx):

_sync_contact_vids(catalog, vids, schema, bumble_bee, bookmark_values, bookmark_key)

STATE = singer.write_bookmark(STATE, 'contacts', bookmark_key, utils.strftime(max_bk_value))
STATE = singer.write_bookmark(STATE, 'contacts', bookmark_key, utils.strftime(min(sync_start_time, max_bk_value)))
singer.write_state(STATE)
return STATE

Expand Down