-
-
Notifications
You must be signed in to change notification settings - Fork 396
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
Parametrize UPDATE, DELETE and bulk operations #1785
Parametrize UPDATE, DELETE and bulk operations #1785
Conversation
@@ -76,6 +77,11 @@ def to_db_time( | |||
return None | |||
|
|||
|
|||
# Converts Decimal to string for sqlite in cases where it's hard to know the | |||
# related field, e.g. in raw queries, math or annotations. | |||
sqlite3.register_adapter(Decimal, str) |
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.
Django uses the same approach https://github.com/django/django/blob/857b1048d53ebf5fc5581c110e85c212b81ca83a/django/db/backends/sqlite3/base.py#L55
Pull Request Test Coverage Report for Build 12116346174Details
💛 - Coveralls |
843cecc
to
fa7c374
Compare
0.22.1 | ||
------ | ||
Fixed | ||
^^^^^ | ||
- Fix unable to use ManyToManyField if OneToOneField passed as Primary Key (#1783) | ||
- Fix sorting by Term (e.g. RawSQL) (#1788) | ||
|
||
Changed | ||
^^^^^^^ | ||
- Parametrizes SELECT queries including `.count()`, `.exists()`, `.values()`, `.values_list()` (#1777) |
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.
We released this with 0.22.1 too 🙃 I'll be updating CHANGELOG from now on in my PR to avoid missing things like that.
@abondar can you have a look at this? Thanks! |
Description
It's a follow up to #1777.
We will also need to parametrize fetching of m2m fields, prefetching, etc. but these are not posing security risks. I'll do them as a separate PR.
Motivation and Context
Parameterized queries are crucial for preventing SQL injection attacks and but also can improve performance of database operations.
Related ticket #81
v1.0.0 target #19
How Has This Been Tested?
Checklist: