While trying to dumpdata
in Django with the following command:
python manage.py dumpdata --all --output /data/django_dump.json --verbosity 3
I get the following error:
CommandError: Unable to serialize database: ('HY000', '[HY000] [Microsoft][ODBC Driver 17 for SQL Server]Connection is busy with results for another command (0) (SQLExecDirectW)')
Exception ignored in: <generator object _cursor_iter at 0x7f1c4112b0c0>
Traceback (most recent call last):
File "/opt/conda/lib/python3.7/site-packages/sql_server/pyodbc/compiler.py", line 133, in _cursor_iter
cursor.close()
File "/opt/conda/lib/python3.7/site-packages/sql_server/pyodbc/base.py", line 500, in close
self.cursor.close()
pyodbc.ProgrammingError: The cursor's connection has been closed.
Following the advice of this post, here's my database configuration:
DATABASES = {
'default': {
'NAME': ...,
'ENGINE': 'sql_server.pyodbc',
'HOST': ...,
'USER': ...,
'PASSWORD': ...,
'OPTIONS': {
'driver': 'ODBC Driver 17 for SQL Server',
'MARS_Connection': True,
}
}
}
Using the MARS connection doesn't seem to help at all. Is my configuration wrong? Is there some other reason this might not work?
Python>=3.6, Django>=2, using MS SQL Server (not sure which version, nothing too old) and django-pyodbc-azure from conda-forge.