djangodjango-mssql

django inspectdb AttributeError: 'unicode' object has no attribute 'type'


Hi I'm getting an AttributeError while using inspectdb.

Please help me. Thanks.

ERROR:

from django.db import models 
Traceback (most recent call last):
File "manage.py", line 10, in <module> execute_from_command_line(sys.argv)
File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line 338, in execute_from_command_line utility.execute()
File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line 330, in execute self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Python27\lib\site-packages\django\core\management\base.py", line 390, in run_from_argv self.execute(*args, **cmd_options)
File "C:\Python27\lib\site-packages\django\core\management\base.py", line 442, in execute output = self.handle(*args, **options)
File "C:\Python27\lib\site-packages\django\core\management\commands\inspectdb.py", line 25, in handle for line in self.handle_inspection(options): 
File "C:\Python27\lib\site-packages\django\core\management\commands\inspectdb.py", line 55, in handle_inspection for table_name in connection.introspection.table_names(cursor): 
File "C:\Python27\lib\site-packages\django\db\backends\__init__.py", line 1310, in table_names return get_names(cursor)
File "C:\Python27\lib\site-packages\django\db\backends\__init__.py", line 1306, in get_names if include_views or ti.type == 't']) 
AttributeError: 'unicode' object has no attribute 'type'

DB SETUP:

DATABASES = {
'default': {
    'ENGINE': 'sqlserver_ado',
    'HOST': 'DB_SERVER',
    'NAME': 'DB_NAME',
    'USER': 'SOME_USER',
    'PASSWORD': 'SOMEONE_PASSWORD',
}
}

Solution

  • I manually create my models now I was able to connect to the MS SQL Server.