From e16694c48a58f6cbad68f9bcdb28aac47b664179 Mon Sep 17 00:00:00 2001 From: Vinicius Mesel <4984147+vmesel@users.noreply.github.com> Date: Fri, 5 Jan 2024 11:47:27 -0300 Subject: [PATCH 1/3] Adds properties handling with string joining --- tap_hubspot_beta/client_v1.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tap_hubspot_beta/client_v1.py b/tap_hubspot_beta/client_v1.py index 4f6aa1d..4e3c157 100644 --- a/tap_hubspot_beta/client_v1.py +++ b/tap_hubspot_beta/client_v1.py @@ -50,7 +50,7 @@ def get_url_params( if next_page_token: params.update(next_page_token) params.update(self.additional_prarams) - params["property"] = self.selected_properties + params["property"] = ",".join(self.selected_properties) return params def post_process(self, row: dict, context: Optional[dict]) -> dict: From ace2eb50ffdc4bac89eed7399875f5dc1ccbf083 Mon Sep 17 00:00:00 2001 From: Vinicius Mesel <4984147+vmesel@users.noreply.github.com> Date: Fri, 5 Jan 2024 12:56:57 -0300 Subject: [PATCH 2/3] Adds better property handling on other streams --- tap_hubspot_beta/client_v3.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tap_hubspot_beta/client_v3.py b/tap_hubspot_beta/client_v3.py index 6c49b83..acdfa66 100644 --- a/tap_hubspot_beta/client_v3.py +++ b/tap_hubspot_beta/client_v3.py @@ -96,7 +96,7 @@ def prepare_request_payload( if self.name =="deals_association_parent": payload["properties"] = ["id"] else: - payload["properties"] = self.selected_properties + payload["properties"] = ",".join(self.selected_properties) else: payload["properties"] = [] return payload @@ -205,7 +205,7 @@ def get_url_params( params["limit"] = self.page_size params.update(self.additional_prarams) if self.properties_url: - params["properties"] = self.selected_properties + params["properties"] = ",".join(self.selected_properties) if next_page_token: params["after"] = next_page_token return params From b7f58d8946525401e014fc26e9d92aa9d82e4ea1 Mon Sep 17 00:00:00 2001 From: Vinicius Mesel <4984147+vmesel@users.noreply.github.com> Date: Mon, 8 Jan 2024 12:17:16 -0300 Subject: [PATCH 3/3] Forces custom_fields to be a list of strings --- tap_hubspot_beta/streams.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tap_hubspot_beta/streams.py b/tap_hubspot_beta/streams.py index efd37e9..c02eafe 100644 --- a/tap_hubspot_beta/streams.py +++ b/tap_hubspot_beta/streams.py @@ -1,6 +1,7 @@ """Stream type classes for tap-hubspot.""" from datetime import datetime from typing import Any, Dict, Iterable, List, Optional +import json import copy from singer_sdk.exceptions import InvalidStreamSortException @@ -165,6 +166,15 @@ def parse_response(self, response): for identity in identity_profile["identities"]: if identity['type'] == 'EMAIL': record['subscriber_email'] = identity['value'] + if record.get("custom_fields", []): + stringfied_custom_fields = [] + for custom_field in record["custom_fields"]: + if isinstance(custom_field, dict): + stringfied_custom_fields.append( + json.dumps(custom_field) + ) + + yield record def get_child_context(self, record: dict, context: Optional[dict]) -> dict: