Home>
Django
andSQL Server
I'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
Related questions
- python : Data not being pushed into database from Django form
- python : Django and ForeignKey
- python : Django. Using ldap authorization and user groups in different AD domains
- python : mapping to a specific user group in Django 4
- python : cannot import name 'url' from 'django.conf.urls' when working with Django 4.0.1
- python : Try using "django.db.backends.XXX" where XXX is one of:
- python : unable to establish connection between my django project and mongodb database (deployed locally)
- Python and Django version compatibility for an existing project
- python : How to set a date condition in a query with where? [duplicate]
- python : Pull data from different tables django
Not a manual
manage.py inspectdb
Try building a model with.Maybe it works.