Django transaction isolation level in mysql & postgresql

后端 未结 5 927
野趣味
野趣味 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条回答
  •  梦毁少年i
    2020-12-19 16:56

    (Sorry, i can't comment for Danhip) This solution wotked for me (mySQL), I added Peter's code in the DATABASE field:

    DATABASES = {
        'default': {
            (...)
            'OPTIONS': {
                (...),
                "init_command": "SET storage_engine=INNODB, SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED"
            },
         }
    }
    

提交回复
热议问题