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

inspectdb is failing. The list of tables returned do not have types. #106

Open
devanroberts opened this issue Jan 18, 2016 · 2 comments
Open

Comments

@devanroberts
Copy link

I'm new to python and django, if I'm doing something silly, let me know.
I'm using:
django 1.8.8
django-pyodbc 0.3.0
pyodbc 3.0.10
python 3.5 (commented out the lines in base.py to deal with UNICODE problem)

Windows Server 2012 R2
MSSQL 9.00.3042.00

Here is my database definition in django:
'default': {
'ENGINE': "django_pyodbc",
'HOST': "xxxyyyxxx,1433",
'USER': "BillyBob",
'PASSWORD': "YeeeHaw",
'NAME': "BlackHoleOfDeath",
'OPTIONS': {
'host_is_server': True,
'autocommit': True,
'driver': "SQL Server Native Client 11.0"
},
When I run
python .\manage.py inspectdb

It fails in
File "C:\Python35\lib\site-packages\django\db\backends\base\introspection.py", line 54, in
if include_views or ti.type == 't')
AttributeError: 'str' object has no attribute 'type'

I cranked up the debugger and found that
c:\python35\lib\site-packages\django_pyodbc\introspection.py(48)get_table_list()
is returning a list of strings, which happen to be the name of the tables:
['auth_user', 'cpd_customer', 'auth_group', 'auth_message', 'cpd_patient', 'auth_user_groups', ...]

But backends\base\instrospection is expecting a list of objects (maybe tuples) with an attribute named "type".

@RossRogers
Copy link
Contributor

I don't think anyone has attempted a port to Django 1.8.

@dlo dlo added the help wanted label Feb 1, 2018
@dlo dlo added the bug label Mar 7, 2018
@swapnil7002
Copy link

below link will help you
https://docs.djangoproject.com/en/2.0/topics/db/sql/

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

No branches or pull requests

4 participants