Chris Snow
Chris Snow

Reputation: 24596

is database locking enabled by default in django?

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.

Upvotes: 1

Views: 148

Answers (1)

Thomas Orozco
Thomas Orozco

Reputation: 55197

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.

Upvotes: 2

Related Questions