Open KiraTheFirebird opened 4 years ago
Years later but this may help others.
There are wrappers around the actual cursor object when you use Django. In this case there are two, Django itself, and django-mssql.
You can set the fast_executemany
attribute on the true pyodbc.Cursor via:
with connection.cursor() as cursor:
cursor.cursor.cursor.fast_executemany = True
# cursor.executemany() is much faster here
Silly, but without changes to both Django and django-mssql I don't believe there's a cleaner method.
Hello! pyodbc has a fast_executemany feature, which significantly increases inserts speed when using the ODBC Driver 17 for SQL Server driver. It works perfectly when I creating connection and cursor using pyodbc API directly:
However, I get no effect (no speed boost and MSSQL profiler shows the _exec spprepexec calls instead of the _exec spexecute ones, which appear when fast_executemany really works) when using it with Django API (i.e. via wrapper provided by django-mssql-backend):
Am I doing something wrong or this feature simply not implemented?
Thank you.