Home > Blockchain >  How does Django handle multiple CRUD actions on same table? (at same time)
How does Django handle multiple CRUD actions on same table? (at same time)

Time:10-20

I am curious about how Django handles multiple actions to be performed on same table at the same time. I'm using Postgresql with Django ORM.

Does it have locking mechanism to handle such scenario?

If yes then is it by default or any parameter must be added?

CodePudding user response:

Django offers select_for_update manager method for database locking. Be aware that your code must be wrapped with transaction.atomic in order to achieve locking. Otherwise multiple database queries for the same data will not prevent each other. Look at the documentation for more details.

  • Related