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

Fix for prefetch related #1275

Merged
merged 4 commits into from
Mar 23, 2024
Merged

Fix for prefetch related #1275

merged 4 commits into from
Mar 23, 2024

Conversation

collerek
Copy link
Owner

Resolves: #906

fix prefetch related merging same relations refering to the same children models

Copy link

codecov bot commented Mar 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (1ed0d5a) to head (215acc1).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##            master     #1275   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          203       203           
  Lines        14719     14791   +72     
=========================================
+ Hits         14719     14791   +72     
Files Coverage Δ
ormar/fields/foreign_key.py 100.00% <100.00%> (ø)
ormar/fields/many_to_many.py 100.00% <100.00%> (ø)
ormar/models/mixins/__init__.py 100.00% <ø> (ø)
ormar/models/modelproxy.py 100.00% <ø> (ø)
ormar/models/newbasemodel.py 100.00% <ø> (ø)
ormar/queryset/queries/prefetch_query.py 100.00% <100.00%> (ø)
ormar/queryset/queryset.py 100.00% <100.00%> (ø)
ormar/queryset/utils.py 100.00% <100.00%> (ø)
...elations/test_prefetch_related_with_same_models.py 100.00% <100.00%> (ø)
tests/test_utils/test_queryset_utils.py 100.00% <ø> (ø)

Copy link

codspeed-hq bot commented Mar 23, 2024

CodSpeed Performance Report

Merging #1275 will degrade performances by 21.72%

Comparing fix-prefetch-related (215acc1) with master (1ed0d5a)

Summary

⚡ 2 improvements
❌ 5 (👁 5) regressions
✅ 77 untouched benchmarks

Benchmarks breakdown

Benchmark master fix-prefetch-related Change
👁 test_max[250] 10.4 ms 13.2 ms -21.51%
👁 test_min[1000] 12.7 ms 16.3 ms -21.72%
👁 test_making_and_inserting_models_in_bulk[10] 18.5 ms 20.9 ms -11.51%
test_deleting_all[500] 11.8 ms 9.7 ms +22.12%
test_exists[1000] 14.9 ms 11.3 ms +32.38%
👁 test_first[250] 10.2 ms 12.9 ms -20.49%
👁 test_get_or_none[250] 10.3 ms 13.1 ms -20.91%

@collerek collerek merged commit 52d992d into master Mar 23, 2024
20 checks passed
@collerek collerek deleted the fix-prefetch-related branch March 23, 2024 23:00
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.

prefetch_related merges entries when many-to-many fields point to the same table
1 participant