Charles Feduke
08/06/2024, 8:22 PMtarget-redshift
? Encountered an error where Decimal data is failing to dump to CSV prior to being uploaded to S3 at https://github.com/TicketSwap/target-redshift/blob/c483ee2c32b5e663d754b39330406e8d19132ef0/target_redshift/sinks.py#L215:
{key: (json.dumps(value).replace("None", "") if key in object_keys else value) for key, value in record.items()}
We’re seeing:
TypeError: Object of type Decimal is not JSON serializable
The fix seems to be to json.dumps(value, default=str)
which allows a Decimal to encode into a string just fine (I say just fine because I don’t have a deep enough knowledge of Python to speak authoritatively), but I’m wondering if there’s maybe a reason why a default type is not specified here.Charles Feduke
08/06/2024, 8:22 PMCharles Feduke
08/06/2024, 10:10 PM