Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GTC-2788 Do proper serialization for UUIDs #519

Merged
merged 2 commits into from
May 17, 2024
Merged

GTC-2788 Do proper serialization for UUIDs #519

merged 2 commits into from
May 17, 2024

Conversation

danscales
Copy link
Collaborator

GTC-2788 Do proper serialization for UUIDs

This is in case there is a unusual query that does SELECT(*) on a dataset that has a UUID field. Currently, we get a 500 with an error "TypeError: Type is not JSON serializable: asyncpg.pgproto.pgproto.UUID".

We need to force UUID to str so it can be serialized, just as we are already doing with Decimal.

https://stackoverflow.com/questions/64395136/typeerror-object-of-type-uuid-is-not-json-serializable

I don't see any easy way to test via tests or in dev (need a dataset with UUID field in it), but will test on real datasets once this is in staging.

This is in case there is a unusual query that does SELECT(*) on a
dataset that has a UUID field. Currently, we get a 500 with an error
"TypeError: Type is not JSON serializable: asyncpg.pgproto.pgproto.UUID".

We need to force UUID to str so it can be serialized, just as we are
already doing with Decimal.

https://stackoverflow.com/questions/64395136/typeerror-object-of-type-uuid-is-not-json-serializable
Copy link
Member

@dmannarino dmannarino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thanks for fixing this!

@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 0% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 81.69%. Comparing base (6d407b2) to head (857c2d5).

Files Patch % Lines
app/responses.py 0.00% 1 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop     #519   +/-   ##
========================================
  Coverage    81.69%   81.69%           
========================================
  Files          125      125           
  Lines         5610     5610           
========================================
  Hits          4583     4583           
  Misses        1027     1027           
Flag Coverage Δ
unittests 81.69% <0.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@danscales danscales merged commit 926801e into develop May 17, 2024
2 checks passed
@danscales danscales deleted the gtc-2788 branch May 17, 2024 01:58
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.

5 participants