Opened 8 years ago
Last modified 13 months ago
#27833 assigned Bug
prefetch_related fails with SQLite when used with 1000 parent records — at Initial Version
Reported by: | Jason Barnabe | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 1.10 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | yes |
Easy pickings: | no | UI/UX: | no |
Description
This is described in https://code.djangoproject.com/ticket/16937#comment:3, but I don't see any issue filed for it.
"[prefetch_related] will not work on some backends if you have a lot of objects in your queryset. For example the SQLite backend has a limitation of 999 parameters to single SQL query, so if you have 1000 objects, prefetch_related will fail as you need to supply 1000 id values to the query."'
Batch it up like in #16426 and #17788, which dealt with the same limitation?