Does default isolation level setting in Django depend on database default isolation level?

I read Isolation level in Django documentation and it says as shown below:

Like PostgreSQL itself, Django defaults to the READ COMMITTED isolation level.

So, if I use Django with MySQL whose default isolation level is REPEATABLE READ:

  • Is the default isolation level setting in Django also REPEATABLE READ?

Or

  • Is the default isolation level setting in Django still READ COMMITTED?

check the source code of django

django.db.backends.mysql.base.py

Here you will get the line as

options = settings_dict['OPTIONS'].copy()
isolation_level = options.pop('isolation_level', 'read committed')
if isolation_level:
    isolation_level = isolation_level.lower()
    if isolation_level not in self.isolation_levels:
        raise ImproperlyConfigured(
            "Invalid transaction isolation level '%s' specified.\n"
            "Use one of %s, or None." % (
                isolation_level,
                ', '.join("'%s'" % s for s in sorted(self.isolation_levels))
            ))
self.isolation_level = isolation_level

so you got your answer.

Back to Top