lionheart / django-pyodbc

An ODBC-powered MS SQL Server DB backend for Django 1.4+
Apache License 2.0
203 stars 103 forks source link

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

Open devanroberts opened 8 years ago

devanroberts commented 8 years ago

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 commented 8 years ago

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

swapnil7002 commented 6 years ago

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