i want to bulk insert in my custom app, how can i do that without inserting one by one at a time
Frappe doesn’t support bulk insert. Any bulk insert APIs that exists primarily do it in a loop. This is a trade-off resulting from the way doctype controllers allow hooking into events before document is inserted.
If it’s boring CRUD bulk insert then you can try these
- Use
doc.db_insert()
in loop for all docs, will skip all events and methods defined on doctype. - Use experimental bulk insert (experimental, same problems as before only works on basic CRUD) feat: bulk insert simple Docs and iterator support for db.bulk_insert by ankush · Pull Request #17150 · frappe/frappe · GitHub
- Use db.bulk_insert if you know column and rows (risky)
1 Like