Opened 4 years ago
Last modified 4 years ago
#31749 closed New feature
Unable to find effective method to bulk_update else create — at Initial Version
Reported by: | Vishesh Mangla | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 3.0 |
Severity: | Normal | Keywords: | bulk_update, bulk_create |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
I 'm making this code where on daily basis after preprocessing a csv file 100, 000 -200, 000 or even more rows will be read. Each row will get converted to a model object. Now the csv says me nothing about whether those ids existed in the database or not. I have been said
"update if key already present else create a new one". And the client has superficial demands that it should be done in seconds. I said that it's not possible and somehow he is ready to wait for 15 minutes at the max. That's why I 'm refraining from using create_or_update or other functions. Is there any way to achieve the speed and accomplish the task at the same time? There are around 100 columns and the file is being read in small chunks because I can't read it whole in the memory. It's whopping 140 mbs.