-
Notifications
You must be signed in to change notification settings - Fork 472
replace % with mod() SQL function to avoid invalid double-percentage … #923
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
base: main
Are you sure you want to change the base?
Conversation
3455663
to
014e922
Compare
for more information, see https://pre-commit.ci
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.
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
Func
class usingMOD
function - Wraps the expression in
ExpressionWrapper
with proper output field type - Adds necessary imports for
ExpressionWrapper
andFunc
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 Sentry. 🚀 New features to boost your workflow:
|
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.
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 <[email protected]>
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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: