django-pyodbc-azure
django-pyodbc-azure copied to clipboard
_is_relevant_relation missing from import
While making initial migrations ran into the below error, caused by
File "C:\Users\USERNAME\Envs\PROJECTNAME\lib\site-packages\sql_server\pyodbc\schema.py", line 406, in _alter_field
if _is_relevant_relation(rel, new_field) and rel.field.db_constraint:
NameError: name '_is_relevant_relation' is not defined
I looked into the file and it looks like it was just missing the import. I added it and the migration completed.
If you want I can put in a pull request, but I thought that was a little much for adding an import statement.
Here is the rest of the error log:
Running migrations:
Applying auth.0008_alter_user_username_max_length...Traceback (most recent call last):
File "manage.py", line 15, in <module>
execute_from_command_line(sys.argv)
File "C:\Users\USERNAME\Envs\PROJECTNAME\lib\site-packages\django\core\management\__init__.py", line 371, in execute_from_command_line
utility.execute()
File "C:\Users\USERNAME\Envs\PROJECTNAME\lib\site-packages\django\core\management\__init__.py", line 365, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Users\USERNAME\Envs\PROJECTNAME\lib\site-packages\django\core\management\base.py", line 288, in run_from_argv
self.execute(*args, **cmd_options)
File "C:\Users\USERNAME\Envs\PROJECTNAME\lib\site-packages\django\core\management\base.py", line 335, in execute
output = self.handle(*args, **options)
File "C:\Users\USERNAME\Envs\PROJECTNAME\lib\site-packages\django\core\management\commands\migrate.py", line 200, in handle
fake_initial=fake_initial,
File "C:\Users\USERNAME\Envs\PROJECTNAME\lib\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 "C:\Users\USERNAME\Envs\PROJECTNAME\lib\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 "C:\Users\USERNAME\Envs\PROJECTNAME\lib\site-packages\django\db\migrations\executor.py", line 244, in apply_migration
state = migration.apply(state, schema_editor)
File "C:\Users\USERNAME\Envs\PROJECTNAME\lib\site-packages\django\db\migrations\migration.py", line 122, in apply
operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
File "C:\Users\USERNAME\Envs\PROJECTNAME\lib\site-packages\django\db\migrations\operations\fields.py", line 216, in database_forwards
schema_editor.alter_field(from_model, from_field, to_field)
File "C:\Users\USERNAME\Envs\PROJECTNAME\lib\site-packages\django\db\backends\base\schema.py", line 525, in alter_field
old_db_params, new_db_params, strict)
File "C:\Users\USERNAME\Envs\PROJECTNAME\lib\site-packages\sql_server\pyodbc\schema.py", line 406, in _alter_field
if _is_relevant_relation(rel, new_field) and rel.field.db_constraint:
NameError: name '_is_relevant_relation' is not defined
@Benaiah2320 Thank you for reporting and sorry for inconvenience. The new bug fix release is available on PyPI now.
Hey no problem! Thanks for maintaining this, its a huge help!
Hey, Is there any chance of backporting the fix in 1.11.13 release? Thanks
@ejba It is already available on PyPI (v1.11.13.1). Please let me know if you still see the same error on your Django 1.11 apps. https://pypi.org/project/django-pyodbc-azure/1.11.13.1/#history