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
Fixed #32226 QuerySet.explain(format='json') outputs repr'd JSON on PostgreSQL #13867
Conversation
Ticket 32226
Fixed #32226 -- changed format from str to json
Fixed #32226 changes for isort issue
Ticket 32226
Fixed #32226 isort issue
Ticket 32226
final isort fix
@felixxm could you please check and review ? |
Please don't @ the fellows for review. They review tickets that are marked as ready on trac in time. You have test failures and merge conflicts. Please rebase the branch to fix the conflicts and address the test failures. |
return '\n'.join(compiler.explain_query()) | ||
if connection.vendor == 'postgresql': | ||
if format == 'json': | ||
return json.loads(json.dumps(ast.literal_eval('\n'.join(compiler.explain_query()))))[0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think the ast.literal_eval
approach is the best. I only included the code as an example on the ticket. It would be better to never force the result into a string in the first place.
No description provided.