Skip to content

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

@devanroberts

Description

@devanroberts

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".

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions