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

Replaces count by exists in populate_history command #982

Merged

Conversation

fabiocapsouza
Copy link

@fabiocapsouza fabiocapsouza commented May 4, 2022

Description

Replaces a count() query in populate_history command by exists()

Related Issue

#922

Motivation and Context

The populate_history command checks if historical records exist for each model. However, this check uses a count query that can be expensive if the historical table is large. An exists query serves this purpose and is much faster to run.

How Has This Been Tested?

I ran all tests using the runtests.py script and sqlite3 database.

The populate_history command is already tested by TestPopulateHistory TestCase and covers this change.

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have run the pre-commit run command to format and lint.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • I have added my name and/or github handle to AUTHORS.rst
  • I have added my change to CHANGES.rst
  • All new and existing tests passed.

@fabiocapsouza fabiocapsouza marked this pull request as ready for review May 4, 2022 17:19
@codecov
Copy link

codecov bot commented May 5, 2022

Codecov Report

Merging #982 (ac5a83d) into master (720fd8a) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master     #982   +/-   ##
=======================================
  Coverage   97.64%   97.64%           
=======================================
  Files          23       23           
  Lines        1147     1147           
  Branches      222      222           
=======================================
  Hits         1120     1120           
  Misses         12       12           
  Partials       15       15           
Impacted Files Coverage Δ
...le_history/management/commands/populate_history.py 96.00% <100.00%> (ø)

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 720fd8a...ac5a83d. Read the comment docs.

@jeking3 jeking3 merged commit 46c5f2c into jazzband:master May 7, 2022
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