Skip to content

Commit

Permalink
update transformation reference
Browse files Browse the repository at this point in the history
  • Loading branch information
pnilan committed Nov 6, 2024
1 parent 5e57dbb commit 493fed4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 493fed4

Please sign in to comment.