Skip to content

support params in sql panel that cannot be JSON encoded by default JSONEncoder #882

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

Closed
zt-initech opened this issue Sep 26, 2016 · 1 comment
Labels

Comments

@zt-initech
Copy link
Contributor

If sql params are values that cannot be encoded by the built-in json.JSONEncoder, then the sql panel doesn't get the params and subsequently can't perform the query or EXPLAIN the query.

In my case, I often have params that are instance of datetime.datetime.

I currently use the following patch: zt-initech@47e7664

It is not very nice. I don't like using both JSON and pickle, and there are probably other problems.

How do you think this problem should be fixed?
For example, should params always be pickled?
Can you help me fix this patch to get it merged upstream?

@zt-initech
Copy link
Contributor Author

This issue is probably related: #747

@aaugustin aaugustin added the Bug label Oct 5, 2016
jieter added a commit to zostera/django-debug-toolbar that referenced this issue Dec 22, 2017
The param `strings_only=True` caused params with type `time`, `date` and
`datetime` to not be converted to string by `NormalCursorWrapper._decode()`,
and in turn causes the json dumping to fail.

This change keeps `strings_only=True` for every type but datetime, date and
time, enabling conversion to string in those cases.

Fixes django-commons#882
jieter added a commit to zostera/django-debug-toolbar that referenced this issue Dec 22, 2017
The param `strings_only=True` caused params with type `time`, `date` and
`datetime` to not be converted to string by `NormalCursorWrapper._decode()`,
and in turn causes the json dumping to fail.

This change keeps `strings_only=True` for every type but datetime, date and
time, enabling conversion to string in those cases.

Fixes django-commons#882
jieter added a commit to zostera/django-debug-toolbar that referenced this issue Dec 22, 2017
The param `strings_only=True` caused params with type `time`, `date` and
`datetime` to not be converted to string by `NormalCursorWrapper._decode()`,
and in turn causes the json dumping to fail.

This change keeps `strings_only=True` for every type but datetime, date and
time, enabling conversion to string in those cases.

Fixes django-commons#882
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants