Skip to content

Fix decimal.Decimal serialization in process_record#73

Open
yotamobol wants to merge 1 commit intoDatateer:mainfrom
yotamobol:fix/decimal-serialization
Open

Fix decimal.Decimal serialization in process_record#73
yotamobol wants to merge 1 commit intoDatateer:mainfrom
yotamobol:fix/decimal-serialization

Conversation

@yotamobol
Copy link
Copy Markdown

Summary

  • Add a default serializer to orjson.dumps() in GCSSink.process_record to handle decimal.Decimal values by converting them to float
  • singer-sdk 0.40+ passes Decimal for numeric fields (for precision), but orjson cannot serialize them natively

Fixes #72

Test plan

  • Run target-gcs with a tap that produces decimal.Decimal values (e.g. account balances)
  • Verify records are written to GCS without TypeError
  • Verify numeric precision is preserved (float conversion)

🤖 Generated with Claude Code

singer-sdk 0.40+ passes decimal.Decimal values in records for numeric
fields. orjson.dumps() does not natively handle Decimal, causing a
TypeError crash. Add a default serializer that converts Decimal to float.

Fixes Datateer#72

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@yotamobol
Copy link
Copy Markdown
Author

@frctnlss can you please take a look?

@yotamobol
Copy link
Copy Markdown
Author

@aroder can you please take a look?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TypeError: decimal.Decimal not JSON serializable with singer-sdk 0.40+

1 participant