Hi, I am following the Django tutorial, and on the migration part of the tutorial I get a error message saying
“KeyError: ‘include’”
It originates from python trying to run
def __str__(self):
return self.template % self.parts
In the ddl_references.py.
Where self.template = ‘CREATE UNIQUE INDEX %(name)s ON %(table)s (%(columns)s)%(include)s%(condition)s’
While self.parts is a dictionary with some keys and values (but not the ‘include’ key)
I have tried to pinpoint the problem, to no avail. Has anyone else noticed this before?
Python library versions:
Django 3.2
Pyodbc 4.0.30
django-mssql-backend 2.8.1
I found the answer in a project based on the backend that I’m using:
opened 11:12AM - 07 Apr 21 UTC
```
# python manage.py migrate
Operations to perform:
Apply all migrations:… admin, auth, contenttypes, hunt, sessions
Running migrations:
Applying contenttypes.0001_initial...Traceback (most recent call last):
File "manage.py", line 21, in <module>
main()
File "manage.py", line 17, in main
execute_from_command_line(sys.argv)
File "/tmp/8d8f9b414dbe185/antenv/lib/python3.8/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
utility.execute()
File "/tmp/8d8f9b414dbe185/antenv/lib/python3.8/site-packages/django/core/management/__init__.py", line 413, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/tmp/8d8f9b414dbe185/antenv/lib/python3.8/site-packages/django/core/management/base.py", line 354, in run_from_argv
self.execute(*args, **cmd_options)
File "/tmp/8d8f9b414dbe185/antenv/lib/python3.8/site-packages/django/core/management/base.py", line 398, in execute
output = self.handle(*args, **options)
File "/tmp/8d8f9b414dbe185/antenv/lib/python3.8/site-packages/django/core/management/base.py", line 89, in wrapped
res = handle_func(*args, **kwargs)
File "/tmp/8d8f9b414dbe185/antenv/lib/python3.8/site-packages/django/core/management/commands/migrate.py", line 244, in handle
post_migrate_state = executor.migrate(
File "/tmp/8d8f9b414dbe185/antenv/lib/python3.8/site-packages/django/db/migrations/executor.py", line 117, in migrate
state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial)
File "/tmp/8d8f9b414dbe185/antenv/lib/python3.8/site-packages/django/db/migrations/executor.py", line 147, in _migrate_all_forwards
state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
File "/tmp/8d8f9b414dbe185/antenv/lib/python3.8/site-packages/django/db/migrations/executor.py", line 227, in apply_migration
state = migration.apply(state, schema_editor)
File "/tmp/8d8f9b414dbe185/antenv/lib/python3.8/site-packages/django/db/migrations/migration.py", line 126, in apply
operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
File "/tmp/8d8f9b414dbe185/antenv/lib/python3.8/site-packages/django/db/migrations/operations/models.py", line 528, in database_forwards
alter_together(
File "/tmp/8d8f9b414dbe185/antenv/lib/python3.8/site-packages/mssql/schema.py", line 167, in alter_unique_together
self.execute(sql)
File "/tmp/8d8f9b414dbe185/antenv/lib/python3.8/site-packages/mssql/schema.py", line 856, in execute
sql = str(sql)
File "/tmp/8d8f9b414dbe185/antenv/lib/python3.8/site-packages/django/db/backends/ddl_references.py", line 201, in __str__
return self.template % self.parts
KeyError: 'include'
```
In short, Django 3.2 is not yet supported