Home>

DjangoandSQL ServerI'm writing a program that reads data from, but an object that is different from the actual database name is created, resulting in an error.
The content of the error is as follows, but I don't understand why'app_usertable' is generated.
I get the same error when using the raw method.

('42S02', "[42S02] [Microsoft] [ODBC Driver 17 for SQL Server] [SQL Server] The object name'app_usertable' is invalid. (208) (SQLExecDirectW); [42S02] [Microsoft] [ ODBC Driver 17 for SQL Server] The [SQL Server] statement could not be prepared. (8180) ")

models.py

class UserTable (models.Model):
    userid= models.CharField (max_length= 32)
    username= models.CharField (max_length= 32)
    def __str__ (self):
        return self.name

views.py

data= UserTable.objects.filter (userid='sato')
for x in data:
    print (x.userid)
  • Answer # 1

    Not a manualmanage.py inspectdbTry building a model with.
    Maybe it works.