-
Type:
Improvement
-
Resolution: Fixed
-
Priority:
Minor - P4
-
Affects Version/s: None
-
Component/s: django
-
None
-
None
-
Python Drivers
-
Not Needed
-
None
-
None
-
None
-
None
-
None
-
None
Context
Django provides the following methods to execute raw SQL queries:
with connection.cursor() as cursor:
cursor.executemany(query, args)
cursor.execute(query, args)
With MongoDB, this crashes:
File "/home/tim/code/django/tests/backends/tests.py", line 330, in create_squares
cursor.executemany(query, args)
^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'executemany'
Definition of done
execute() and execute_many() stub methods that raise django.db.NotSupportedError must be added to django-mongodb-backend's Cursor.
(I believe it's unnecessary to raise errors for the reading methods [fetchone, fetchmany, fetchall, nextset] since these would only be called after the execute methods.)