Opened 2 years ago
Last modified 8 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 , 2 years ago
Cc: | added |
---|---|
Component: | Uncategorized → Database layer (models, ORM) |
Triage Stage: | Unreviewed → Accepted |
Type: | Uncategorized → New feature |
Version: | 4.1 → dev |
comment:2 by , 2 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:3 by , 2 years 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 , 13 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 , 13 months ago
Needs documentation: | unset |
---|
comment:6 by , 13 months ago
Patch needs improvement: | set |
---|
comment:7 by , 12 months ago
Patch needs improvement: | unset |
---|
comment:8 by , 12 months ago
Needs documentation: | set |
---|---|
Patch needs improvement: | set |
comment:9 by , 12 months ago
Needs documentation: | unset |
---|---|
Patch needs improvement: | unset |
comment:10 by , 12 months ago
Needs documentation: | set |
---|---|
Needs tests: | set |
Patch needs improvement: | set |
comment:11 by , 12 months ago
Needs documentation: | unset |
---|---|
Needs tests: | unset |
Patch needs improvement: | unset |
comment:12 by , 12 months ago
Patch needs improvement: | set |
---|
comment:14 by , 12 months ago
Patch needs improvement: | set |
---|
comment:16 by , 12 months ago
Patch needs improvement: | set |
---|
comment:18 by , 11 months ago
Patch needs improvement: | set |
---|
comment:19 by , 11 months ago
Patch needs improvement: | unset |
---|
comment:20 by , 11 months ago
Patch needs improvement: | set |
---|
comment:22 by , 9 months ago
Patch needs improvement: | set |
---|
comment:24 by , 9 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 , 8 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.