0

I've been doing some work in Django and noticed most people push save() right away after the change to model has been made

for example in SQLAlchemy if we loop over few db objects and do modification after the loop we can say db.session.commit() saying to commit everything that has been done and save some performance but committing in bulk rather on each loop

Is there a similar function for Django?

1 Answers1

0

You can apply .save() only for one instance. If you want to update many instances you can use bulk_update https://docs.djangoproject.com/en/3.1/ref/models/querysets/#bulk-update

Saichenko
  • 1
  • 2