1

Some frameworks are opinionated when it comes to database locking. For example, grails orm (gorm) documents state the following:

By default GORM classes are configured for optimistic locking

Source: https://grails.github.io/grails-doc/latest/guide/GORM.html#locking

I've read through some material online for django and my understanding is that django does not provide locking by default. Some examples:

(The above questions are different to this one. Those questions are asking how you manage concurrency. This question is asking what is the default concurrency control.)

What is django's default approach to database locking? It seems that database locking is not enabled by default in django?


NOTE: This is NOT a question about which approach is best, it is a question to confirm django's approach to locking.

Community
  • 1
  • 1
Chris Snow
  • 23,813
  • 35
  • 144
  • 309
  • 1
    If this question does not fit stackoverflow's requirements, and you down vote it please let me know why so that I can improve the question. – Chris Snow Apr 22 '15 at 08:51
  • possible duplicate of [Django: How can I protect against concurrent modification of database entries](http://stackoverflow.com/questions/320096/django-how-can-i-protect-against-concurrent-modification-of-database-entries) – Kishor Pawar Apr 22 '15 at 08:59
  • 1
    @KishorPawar: _that_ question is asking *how* you manage concurrency. _this_ question is asking *what* is the default concurrency control. – Chris Snow Apr 22 '15 at 09:09

1 Answers1

2

There is no such option in Django (though implementing a similar mechanism yourself is rather easy).

Do note, however, that what GORM calls "Optimistic Locking" has little to do with database locking (that's the point of it being optimistic).

You'll probably want to have a look at the documentation page on transactions for more DB internals documentation.

Thomas Orozco
  • 53,284
  • 11
  • 113
  • 116