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

Add PRETTIFY_SQL setting to control token grouping in SQL panel #1438

Merged
merged 4 commits into from
Jan 22, 2021

Conversation

alkihis
Copy link
Contributor

@alkihis alkihis commented Jan 21, 2021

As discussed in #1402, this PR expose a new setting, "PRETTIFY_SQL" which controls token grouping in SQL panel.
It is set as True by default in order to preserve current behaviour.

It should be disabled if a django application makes a very long textual SQL query, which will cause a huge slowdown during toolbar render.

This is a new PR (original #1404) to fix some commit issues as reported in this comment.

@codecov
Copy link

codecov bot commented Jan 21, 2021

Codecov Report

Merging #1438 (e1864e9) into master (ea65261) will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1438      +/-   ##
==========================================
+ Coverage   87.44%   87.46%   +0.01%     
==========================================
  Files          29       29              
  Lines        1577     1579       +2     
  Branches      220      221       +1     
==========================================
+ Hits         1379     1381       +2     
  Misses        146      146              
  Partials       52       52              
Impacted Files Coverage Δ
debug_toolbar/panels/sql/utils.py 92.15% <100.00%> (+0.32%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ea65261...e1864e9. Read the comment docs.

Copy link
Contributor

@tim-schilling tim-schilling left a comment

Choose a reason for hiding this comment

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

Well done! I appreciate the example in the documentation.

@@ -221,6 +221,40 @@ Panel options
The SQL panel highlights queries that took more that this amount of time,
in milliseconds, to execute.

* ``PRETTIFY_SQL``
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you move this above PROFILER_MAX_DEPTH to make the settings alphabetical please?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in cbf8f84.

Louis Béranger and others added 2 commits January 22, 2021 09:27
It doesn't validate what PRETTIFY_SQL does explicitly, but that toggling
it changes the output.
Copy link
Contributor

@tim-schilling tim-schilling left a comment

Choose a reason for hiding this comment

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

Thank you for the PR!

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.

2 participants