diff --git a/airbyte-integrations/connectors/source-hubspot/source_hubspot/components.py b/airbyte-integrations/connectors/source-hubspot/source_hubspot/components.py index 32d451adaee4..dff2ac9e161f 100644 --- a/airbyte-integrations/connectors/source-hubspot/source_hubspot/components.py +++ b/airbyte-integrations/connectors/source-hubspot/source_hubspot/components.py @@ -20,7 +20,7 @@ class NewToLegacyFieldTransformation(RecordTransformation): def transform(self, record: Dict[str, Any], config: Optional[Config] = None, stream_state: Optional[StreamState] = None, stream_slice: Optional[StreamSlice] = None, ) -> Mapping[str, Any]: updated_record = copy.deepcopy(record) - for field_name, field_value in record["properties"].items(): + for field_name, field_value in record.get("properties", {}).items(): for legacy_field_prefix, new_field_prefix in NEW_TO_LEGACY_FIELDS_MAPPING.items(): if new_field_prefix in field_name: updated_field_name = field_name.replace(new_field_prefix, legacy_field_prefix) diff --git a/airbyte-integrations/connectors/source-hubspot/source_hubspot/streams.py b/airbyte-integrations/connectors/source-hubspot/source_hubspot/streams.py index 4b8817227e5a..6bddeb354311 100644 --- a/airbyte-integrations/connectors/source-hubspot/source_hubspot/streams.py +++ b/airbyte-integrations/connectors/source-hubspot/source_hubspot/streams.py @@ -691,8 +691,9 @@ def _transform(self, records: Iterable) -> Iterable: record = self._cast_record_fields_if_needed(record) if self.created_at_field and self.updated_at_field and record.get(self.updated_at_field) is None: record[self.updated_at_field] = record[self.created_at_field] - for transformation in self.transformations: - record = transformation().transform(record) + if self.transformations: + for transformation in self.transformations: + record = transformation().transform(record) yield record @staticmethod