Yesterday I figured how to solve this issue using a custom Database 
backend. I'm posting this here to help anyone have the same problem.

1. Create a new python package for it (I recommend use poetry 
<https://python-poetry.org/> for it):

django-mysql-nosavepoint/
> ├── django_mysql_nosavepoint
> │   ├── base.py
> │   └── __init__.py
> ├── LICENSE
> ├── pyproject.toml
> └── README.rst


2. Use poetry to add the dependencies:

poetry add django mysqlclient


3. Add the following code to base.py:

from django.db.backends.mysql import base


class DatabaseFeatures(base.DatabaseFeatures):
uses_savepoints = False


class DatabaseWrapper(base.DatabaseWrapper):
features_class = DatabaseFeatures


4. Use poetry to build the package:

poetry build


5. Install the package with pip:

pip install django_mysql_nosavepoint-0.1.0-py3-none-any.whl

6. Use your new backend of settings.py

DATABASES = {
'default': {
# other stuff
'ENGINE': 'django_mysql_nosavepoint',
}
}

That's it. Hope it helps someone
Em quarta-feira, 22 de janeiro de 2020 17:19:42 UTC-3, Victor Guimarães 
Nunes escreveu:
>
> Hi,
>
> I'm having some trouble setting up a Django project with a MySQL NDB 
> Cluster. I found I had to set the storage engine on 
> DATABASES['default']['OPTIONS'] and I did it.
>
> DATABASES = {
> 'default': config('DATABASE_URL', cast=db_url)
> }
>
> # Check if mysql database engine is NDBCLUSTER
> if config('USE_NDBCLUSTER', cast=bool, default=False):
> DATABASES['default'].update({
> 'OPTIONS': {
> 'init_command': 'SET default_storage_engine=NDBCLUSTER;',
> }
> })
>
> but almost always when I try to perform some write action on the database 
> I get the following esception:
>
> OperationalError at /admin/auth/user/add/
>
> (1178, "The storage engine for the table doesn't support SAVEPOINT")
>
>
> I don't quite get what I supposed to do about once the cluster demands a 
> NDBCLUSTER storage engine to work properly and I don't have any ideia of 
> what is savepoints and where/how I can disabled it.
>
> Any thoughts about this issue?
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/81c78c00-15e8-4ac4-9538-f3b21ca56fcb%40googlegroups.com.

Reply via email to