Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: module 'django.db.models' has no attribute 'UniqueConstraint' #214

Open
daltschu opened this issue Feb 20, 2020 · 0 comments

Comments

@daltschu
Copy link

Hello,

I want to migrate data from a legacy SQL server database (2008 R2) to a postgresql 11 application with django.

At first I did some export of SQL server tables to Excel, then python scripts to read these excel files and populate django models. This works, but I wanted to try and use django-pyodbc-azure to be able to read the table definition in SQL server and define legacy models with inspectb.

Now as soon as I installed django-pyodbc-azure and pyodbc, my development environment
was messed up. Each time I try "python manage.py runserver" I get the message:

Unhandled exception in thread started by <function check_errors..wrapper at 0x0000016B52539268>
Traceback (most recent call last):
....
AttributeError: module 'django.db.models' has no attribute 'UniqueConstraint'

and django won't start.

I do use UniqueConstraint in my models, and I didn't get this error message before I installed pyodbc and django-pyodbc-azure.

Even after uninstalling pyodbc and django-pyodbc-azure the error message persists.

I had to rebuild another virtual environment in order to get back a functioning development environment.

Any ideas?

Thanks
Daniel

Environment:

Windows 10 version 1903
conda 4.6.14
python 3.7.1
django 2.1.7
pyodbc 4.0.30
psycopg2 2.8.4 (postgresql is on a docker container, I use docker desktop for Windows)
postgresql 11.2 on docker
SQL server express 2008 R2 on Windows 10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant