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
Ability to parse UUID #15
Comments
For anyone finding this issue, I bumped into the same situation and managed to find a workaround using FastAPI's from debug_toolbar.panels.sqlalchemy import SQLAlchemyPanel as Base
from fastapi.encoders import jsonable_encoder
class SQLAlchemyPanel(Base):
def after_execute(self, *args) -> None: # type: ignore
# HACK: base SQL panel calls json.dumps(parameters) at some point.
# Ensure values such as UUIDs can be dumped.
parameters = args[3]
args = (*args[:3], jsonable_encoder(parameters), *args[4:])
return super().after_execute(*args) It can then be used by passing Not sure if this should be done by default. |
Closed
Merged
Hey @deby22 , issue is fixed using |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
fastapi-debug-toolbar/debug_toolbar/panels/sql.py
Lines 120 to 121 in 3552b0b
Using UUID field raise an exception
*** TypeError: Object of type UUID is not JSON serializable
I suggest, adding UUID serialization, by cast to str
Or allow setting encoder on json.dumps method
The text was updated successfully, but these errors were encountered: