Skip to content

Commit

Permalink
HGI-6464: export failing on datetime serialization issues
Browse files Browse the repository at this point in the history
  • Loading branch information
hsyyid committed Sep 9, 2024
1 parent 9f586fb commit fc70ccb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
Binary file added .DS_Store
Binary file not shown.
5 changes: 5 additions & 0 deletions target_salesforce_v3/sinks.py
Original file line number Diff line number Diff line change
Expand Up @@ -923,6 +923,11 @@ def preprocess_record(self, record, context):
if self.config.get("only_upsert_empty_fields"):
record = {k:v for k,v in record.items() if not existing_record.get(k)}
record["Id"] = existing_record["Id"]

# convert any datetimes to string to avoid json encoding errors
for key in record:
if isinstance(record.get(key), datetime):
record[key] = record[key].isoformat()
return record

def upsert_record(self, record, context):
Expand Down

0 comments on commit fc70ccb

Please sign in to comment.