I have the following setup for my connections to a MySQL database in Django.
'default': {
'NAME' : MYSQL_DB_NAME,
#'ENGINE' : 'mysql',
'ENGINE' : 'django.db.backends.mysql',
'USER' : 'ccurvey',
'PASSWORD' : MYSQL_PASSWORD,
'HOST' : MYSQL_HOST,
'PORT' : '',
'OPTIONS' : {
'init_command' : 'set storage_engine=INNODB',
},
},
so far, so good.
What's the incantation if I want to add another "set" command to my "init_command"
'init_command' : ('set storage_engine=INNODB',
'set transaction isolation level read committed'),
gives me "connect() argument must be string, not tuple"
'init_command' : ('set storage_engine=INNODB; set transaction isolation level read committed;'),
gives me
_mysql_exceptions.ProgrammingError: (2014, "Commands out of sync; you can't run this command now")
For me what worked was:
{ 'init_command': 'set storage_engine=InnoDB; \
set session transaction isolation level read committed'}
Not is:
"init_command": 'set storage_engine=INNODB, \
set transaction isolation level read committed;', }
It is:
"init_command": 'set storage_engine=INNODB, \
SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED', }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With