Django transaction isolation level in mysql & postgresql

后端 未结 5 913
野趣味
野趣味 2020-12-19 16:44

Do you know the default isolation level of the transactions used in Django? Is it possible to set the isolation level in the database independent way?

I\'m mainly in

5条回答
  •  自闭症患者
    2020-12-19 17:13

    if you want to use read uncommited isolation level.

    you add the 'isolation_level': 'read uncommitted' in 'OPTIONS on database connection configuration.

    DATABASES = {
        'read-uncommited': {
            'OPTIONS': {
                'isolation_level': 'read uncommitted'
            },
        },
    }

    you can find from https://docs.djangoproject.com/en/2.1/ref/databases/

提交回复
热议问题