replace % with mod() SQL function to avoid invalid double-percentage …#923
replace % with mod() SQL function to avoid invalid double-percentage …#923AngryUbuntuNerd wants to merge 4 commits into
Conversation
3455663 to
014e922
Compare
for more information, see https://pre-commit.ci
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a SQL generation issue where Django was producing invalid double-percentage (%%) operators in MySQL queries. The fix replaces the Python modulo operator (%) with Django's Func class using the SQL MOD() function to ensure proper SQL syntax.
Key Changes
- Replaces Python modulo operator with Django's
Funcclass usingMODfunction - Wraps the expression in
ExpressionWrapperwith proper output field type - Adds necessary imports for
ExpressionWrapperandFunc
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #923 +/- ##
==========================================
- Coverage 88.19% 88.18% -0.02%
==========================================
Files 32 32
Lines 1008 1007 -1
Branches 105 105
==========================================
- Hits 889 888 -1
Misses 101 101
Partials 18 18 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
auvipy
left a comment
There was a problem hiding this comment.
is nit pissible to modify the relevant tests as well?
|
can you give me some guidance there:
|
|
this should be the primary file https://github.com/celery/django-celery-beat/blob/main/t/unit/test_schedulers.py and for tests there are docker and tox for running tests locally |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
auvipy
left a comment
There was a problem hiding this comment.
can you please revisit this to update or add relevant tests?
for more information, see https://pre-commit.ci
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
fixes #922
invalid SQL before:
new SQL: