From 43eac43b8e47a6e37fe5bf89e67d4f1fc2b5bb49 Mon Sep 17 00:00:00 2001 From: Hassan Syyid Date: Thu, 16 Nov 2023 09:44:28 -0500 Subject: [PATCH 1/2] Handle case where lineitems_archived is not in catalog --- tap_hubspot_beta/streams.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tap_hubspot_beta/streams.py b/tap_hubspot_beta/streams.py index a693cc1..2332c79 100644 --- a/tap_hubspot_beta/streams.py +++ b/tap_hubspot_beta/streams.py @@ -883,6 +883,10 @@ def selected(self) -> bool: Returns: True if the stream is selected. """ + # It has to be in the catalog or it will cause issues + if not self._tap.catalog.get("lineitems_archived"): + return False + try: # Make this stream auto-select if lineitems is selected self._tap.catalog["lineitems_archived"] = self._tap.catalog["lineitems"] From 654957f79b31f5331399b5e4d5885122fbe27f69 Mon Sep 17 00:00:00 2001 From: Vinicius Mesel Date: Fri, 17 Nov 2023 11:07:28 -0300 Subject: [PATCH 2/2] Changes datetime parser (#11) --- tap_hubspot_beta/streams.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tap_hubspot_beta/streams.py b/tap_hubspot_beta/streams.py index 2332c79..76a861d 100644 --- a/tap_hubspot_beta/streams.py +++ b/tap_hubspot_beta/streams.py @@ -20,6 +20,7 @@ import time import pytz from singer_sdk.helpers._state import log_sort_error +from pendulum import parse class AccountStream(hubspotV1Stream): """Account Stream""" @@ -909,9 +910,7 @@ def post_process(self, row, context): row = super().post_process(row, context) rep_key = self.get_starting_timestamp(context).replace(tzinfo=pytz.utc) - archived_at = datetime.strptime( - row['archivedAt'], "%Y-%m-%dT%H:%M:%S.%fZ" - ).replace(tzinfo=pytz.utc) + archived_at = parse(row['archivedAt']).replace(tzinfo=pytz.utc) if archived_at > rep_key: return row