Opened 22 months ago
Last modified 7 months ago
#34277 assigned New feature
Add where clause in QuerySet.bulk_create() when update_conflicts=True
Reported by: | Alain Delplanque | Owned by: | HAMA Barhamou |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Chih Sean Hsu, HAMA Barhamou | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | yes |
Easy pickings: | no | UI/UX: | no |
Description
To import objects from one database to another, it would be necessary to filter rows that are subject to an update. Which in plain sql looks like:
INSERT INTO my_table (field1, ...) VALUES ... ON CONFLICT (pk) DO UPDATE SET field1 = EXCLUDED.field1, ... WHERE lastupdated < EXCLUDED.lastupdated
Change History (26)
comment:1 by , 22 months ago
Cc: | added |
---|---|
Component: | Uncategorized → Database layer (models, ORM) |
Triage Stage: | Unreviewed → Accepted |
Type: | Uncategorized → New feature |
Version: | 4.1 → dev |
comment:2 by , 22 months ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:3 by , 22 months ago
Thank you for the ticket. I will work on it.
I'm new to this, so your advice would be appreciated.
comment:4 by , 12 months ago
Cc: | added |
---|---|
Has patch: | set |
Needs documentation: | set |
Hello everyone,
I am excited to share that I have worked on implementing the feature requested in this ticket and have submitted a pull request for review. You can view and provide feedback or suggestions here: https://github.com/django/django/pull/17515.
Any comments or suggestions for improving the contribution are welcome. Thank you for the opportunity to contribute to Django, and I look forward to your feedback!
Best regards,
comment:5 by , 11 months ago
Needs documentation: | unset |
---|
comment:6 by , 11 months ago
Patch needs improvement: | set |
---|
comment:7 by , 11 months ago
Patch needs improvement: | unset |
---|
comment:8 by , 11 months ago
Needs documentation: | set |
---|---|
Patch needs improvement: | set |
comment:9 by , 11 months ago
Needs documentation: | unset |
---|---|
Patch needs improvement: | unset |
comment:10 by , 11 months ago
Needs documentation: | set |
---|---|
Needs tests: | set |
Patch needs improvement: | set |
comment:11 by , 11 months ago
Needs documentation: | unset |
---|---|
Needs tests: | unset |
Patch needs improvement: | unset |
comment:12 by , 11 months ago
Patch needs improvement: | set |
---|
comment:14 by , 10 months ago
Patch needs improvement: | set |
---|
comment:16 by , 10 months ago
Patch needs improvement: | set |
---|
comment:18 by , 10 months ago
Patch needs improvement: | set |
---|
comment:19 by , 10 months ago
Patch needs improvement: | unset |
---|
comment:20 by , 9 months ago
Patch needs improvement: | set |
---|
comment:22 by , 8 months ago
Patch needs improvement: | set |
---|
comment:24 by , 8 months ago
Patch needs improvement: | set |
---|
Setting as patch needs improvement following a reviewer request to rebase and squash commits to allow for/ease future review iterations.
comment:26 by , 7 months ago
Patch needs improvement: | set |
---|
Thanks for the ticket (follow up to #31685). Looks like a nice addition, we need to remember that it's not supported on MySQL/MariaDB.