From 4b10340d2ea449184940e9679ff6c3056b5df6ed Mon Sep 17 00:00:00 2001 From: RushiT0122 Date: Tue, 23 Jan 2024 18:35:24 +0000 Subject: [PATCH] - fix out-of-index error - bump version 2.13.2 --- CHANGELOG.md | 3 +++ setup.py | 2 +- tap_hubspot/__init__.py | 6 +++++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d9ed39a8..dd3c698a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog +## 2.13.2 + * Fix out-of-index error [#253](https://github.com/singer-io/tap-hubspot/pull/253) + ## 2.13.1 * Optimise contacts_by_company implementation [#250](https://github.com/singer-io/tap-hubspot/pull/250) diff --git a/setup.py b/setup.py index 849f20f2..c24bb9fa 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ from setuptools import setup setup(name='tap-hubspot', - version='2.13.1', + version='2.13.2', description='Singer.io tap for extracting data from the HubSpot API', author='Stitch', url='http://singer.io', diff --git a/tap_hubspot/__init__.py b/tap_hubspot/__init__.py index 7c827581..15d17f50 100644 --- a/tap_hubspot/__init__.py +++ b/tap_hubspot/__init__.py @@ -569,10 +569,15 @@ def use_recent_companies_endpoint(response): # NB> to do: support stream aliasing and field selection def _sync_contacts_by_company_batch_read(STATE, ctx, company_ids): + # Return state as it is if company ids list is empty + if not len(company_ids): + return STATE + schema = load_schema(CONTACTS_BY_COMPANY) catalog = ctx.get_catalog_from_id(singer.get_currently_syncing(STATE)) mdata = metadata.to_map(catalog.get('metadata')) url = get_url("contacts_by_company_v3") + with Transformer(UNIX_MILLISECONDS_INTEGER_DATETIME_PARSING) as bumble_bee: with metrics.record_counter(CONTACTS_BY_COMPANY) as counter: body = {'inputs': [{'id': company_id} for company_id in company_ids]} @@ -584,7 +589,6 @@ def _sync_contacts_by_company_batch_read(STATE, ctx, company_ids): 'contact-id' : contact['id']} record = bumble_bee.transform(lift_properties_and_versions(record), schema, mdata) singer.write_record("contacts_by_company", record, time_extracted=utils.now()) - if len(company_ids): STATE = singer.set_offset(STATE, "contacts_by_company", 'offset', company_ids[-1]) singer.write_state(STATE) return STATE