database error no such table django -


i have made new app 'api' in django project 'cc'.

i have remote database 'launchg' integrated django using legacies , used python manage.py inspectdb > models.py generate models.py file.

next replaced generated models.py file models.py file in api app.

whenever try fire query database database error:no such table eg :- webquery.objects.all(), throws error stating database error: no such table : web_query

here models.py file

    # auto-generated django model module.     # you'll have following manually clean up:     #     * rearrange models' order       #     * make sure each model has 1 field primary_key=true     # feel free rename models, don't rename db_table values or field names.     #     # note: you'll have insert output of 'django-admin.py sqlcustom [appname]'     # database.     __future__ import unicode_literals      django.db import models        class area(models.model):         area_id = models.bigintegerfield(primary_key=true)         area_name = models.charfield(max_length=50l)         class meta:             db_table = 'area'      class business2(models.model):         business_id = models.bigintegerfield(primary_key=true)         b_name = models.charfield(max_length=50l)         b_phone = models.charfield(max_length=50l)         b_add = models.charfield(max_length=1000l)         area_id = models.charfield(max_length=50l)         categories = models.charfield(max_length=1000l)         rating = models.integerfield()         latitude = models.charfield(max_length=255l)         longitude = models.charfield(max_length=255l)         class meta:             db_table = 'business2'      class businessreply(models.model):         msg_id = models.bigintegerfield(primary_key=true)         conversation_id = models.bigintegerfield()         business_id = models.bigintegerfield()         query_id = models.bigintegerfield()         username = models.charfield(max_length=50l)         message = models.charfield(max_length=500l)         date_time = models.datetimefield()         class meta:             db_table = 'business_reply'      class businessnew(models.model):         business_id = models.bigintegerfield(primary_key=true)         b_name = models.charfield(max_length=50l)         b_phone = models.charfield(max_length=50l)         b_add = models.charfield(max_length=1000l)         area_id = models.charfield(max_length=50l)         categories = models.charfield(max_length=1000l)         rating = models.integerfield()         latitude = models.charfield(max_length=255l)         longitude = models.charfield(max_length=255l)         home_delivery = models.integerfield(db_column='home delivery') # field name made     lowercase. field renamed remove unsuitable characters.         credit_card_facility = models.integerfield(db_column='credit card facility') # field name made lowercase. field renamed remove unsuitable characters.         menu_available = models.integerfield(db_column='menu available') # field name made lowercase. field renamed remove unsuitable characters.     bar_available = models.integerfield(db_column='bar available') # field name made lowercase. field renamed remove unsuitable characters.         dine_in = models.integerfield(db_column='dine in') # field name made lowercase. field renamed remove unsuitable characters.         pure_vegetarian = models.integerfield(db_column='pure vegetarian') # field name made lowercase. field renamed remove unsuitable characters.         cost = models.charfield(max_length=255l, db_column='cost') # field name made lowercase.         timings = models.charfield(max_length=255l, db_column='timings') # field name made lowercase.         check = models.integerfield()         url = models.charfield(max_length=500l)         class meta:             db_table = 'businessnew'       class businessnewbackup(models.model):          business_id = models.bigintegerfield(primary_key=true)          b_name = models.charfield(max_length=50l)     b_phone = models.charfield(max_length=50l)     b_add = models.charfield(max_length=1000l)     area_id = models.charfield(max_length=50l)     categories = models.charfield(max_length=1000l)     rating = models.integerfield()     latitude = models.charfield(max_length=255l)     longitude = models.charfield(max_length=255l)     home_delivery = models.integerfield(db_column='home delivery') # field name made lowercase. field renamed remove unsuitable characters.     credit_card_facility = models.integerfield(db_column='credit card facility') # field name made lowercase. field renamed remove unsuitable characters.     menu_available = models.integerfield(db_column='menu available') # field name made lowercase. field renamed remove unsuitable characters.     bar_available = models.integerfield(db_column='bar available') # field name made lowercase. field renamed remove unsuitable characters.     dine_in = models.integerfield(db_column='dine in') # field name made lowercase. field renamed remove unsuitable characters.     pure_vegetarian = models.integerfield(db_column='pure vegetarian') # field name made lowercase. field renamed remove unsuitable characters.     cost = models.charfield(max_length=255l, db_column='cost') # field name made lowercase.     timings = models.charfield(max_length=255l, db_column='timings') # field name made lowercase.     check = models.integerfield()     class meta:         db_table = 'businessnew_backup'  class businessnewbackup1(models.model):     business_id = models.bigintegerfield(primary_key=true)     b_name = models.charfield(max_length=50l)     b_phone = models.charfield(max_length=50l)     b_add = models.charfield(max_length=1000l)     area_id = models.charfield(max_length=50l)     categories = models.charfield(max_length=1000l)     rating = models.integerfield()     latitude = models.charfield(max_length=255l)     longitude = models.charfield(max_length=255l)     home_delivery = models.integerfield(db_column='home delivery') # field name made lowercase. field renamed remove unsuitable characters.     credit_card_facility = models.integerfield(db_column='credit card facility') # field name made lowercase. field renamed remove unsuitable characters.     menu_available = models.integerfield(db_column='menu available') # field name made lowercase. field renamed remove unsuitable characters.     bar_available = models.integerfield(db_column='bar available') # field name made lowercase. field renamed remove unsuitable characters.     dine_in = models.integerfield(db_column='dine in') # field name made lowercase. field renamed remove unsuitable characters.     pure_vegetarian = models.integerfield(db_column='pure vegetarian') # field name made lowercase. field renamed remove unsuitable characters.     cost = models.charfield(max_length=255l, db_column='cost') # field name made lowercase.     timings = models.charfield(max_length=255l, db_column='timings') # field name made lowercase.     check = models.integerfield()     class meta:         db_table = 'businessnew_backup1'  class businessnewbackup2(models.model):     business_id = models.bigintegerfield(primary_key=true)     b_name = models.charfield(max_length=50l)     b_phone = models.charfield(max_length=50l)     b_add = models.charfield(max_length=1000l)     area_id = models.charfield(max_length=50l)     categories = models.charfield(max_length=1000l)     rating = models.integerfield()     latitude = models.charfield(max_length=255l)     longitude = models.charfield(max_length=255l)     home_delivery = models.integerfield(db_column='home delivery') # field name made lowercase. field renamed remove unsuitable characters.     credit_card_facility = models.integerfield(db_column='credit card facility') # field name made lowercase. field renamed remove unsuitable characters.     menu_available = models.integerfield(db_column='menu available') # field name made lowercase. field renamed remove unsuitable characters.     bar_available = models.integerfield(db_column='bar available') # field name made lowercase. field renamed remove unsuitable characters.     dine_in = models.integerfield(db_column='dine in') # field name made lowercase. field renamed remove unsuitable characters.     pure_vegetarian = models.integerfield(db_column='pure vegetarian') # field name made lowercase. field renamed remove unsuitable characters.     cost = models.charfield(max_length=255l, db_column='cost') # field name made lowercase.     timings = models.charfield(max_length=255l, db_column='timings') # field name made lowercase.     check = models.integerfield()     class meta:         db_table = 'businessnew_backup2'  class businessowners(models.model):     b_phone = models.charfield(max_length=50l)     b_id = models.integerfield()     userid = models.integerfield(primary_key=true, db_column='userid') # field name made lowercase.     firstname = models.charfield(max_length=100l)     lastname = models.charfield(max_length=100l)     email = models.charfield(max_length=150l)     password = models.charfield(max_length=32l, db_column='password') # field name made lowercase.     b_name = models.charfield(max_length=100l)     b_address = models.charfield(max_length=255l)     class meta:         db_table = 'businessowners'  class categories(models.model):     cat = models.charfield(max_length=255l)     syn = models.charfield(max_length=100l)     class meta:         db_table = 'categories'  class cisessions(models.model):     session_id = models.charfield(max_length=40l, primary_key=true)     ip_address = models.charfield(max_length=45l)     user_agent = models.charfield(max_length=120l)     last_activity = models.integerfield()     user_data = models.textfield()     class meta:         db_table = 'ci_sessions'  class query(models.model):     query_id = models.bigintegerfield(primary_key=true)     conversation_id = models.bigintegerfield()     gcm_id = models.charfield(max_length=1000l)     user_id = models.bigintegerfield()     = models.charfield(max_length=20l)     = models.charfield(max_length=500l)     message = models.charfield(max_length=200l)     date_time = models.datetimefield()     class meta:         db_table = 'query'  class querybusiness(models.model):     business_id = models.charfield(max_length=10l)     query_id = models.bigintegerfield()     date_time = models.datetimefield()     class meta:         db_table = 'query_business'  class tzmembers(models.model):     id = models.integerfield(primary_key=true)     usr = models.charfield(max_length=32l, unique=true)     pass_field = models.charfield(max_length=32l, db_column='pass') # field renamed because python reserved word.     email = models.charfield(max_length=255l)     regip = models.charfield(max_length=15l, db_column='regip') # field name made lowercase.     dt = models.datetimefield()     class meta:         db_table = 'tz_members'  class users(models.model):     user_id = models.bigintegerfield(primary_key=true)     username = models.charfield(max_length=20l)     fb_token = models.charfield(max_length=1000l)     email = models.charfield(max_length=50l)     facebook = models.charfield(max_length=50l)     fb_likes = models.textfield()     twitter = models.charfield(max_length=50l)     gmail = models.charfield(max_length=50l)     gcm_id = models.charfield(max_length=1000l)     date_time = models.datetimefield()     last_login = models.datetimefield()     last_push = models.datetimefield()     class meta:         db_table = 'users'  class webquery(models.model):     query_id = models.bigintegerfield(unique=true)     conversation_id = models.charfield(max_length=50l)     u_id = models.charfield(max_length=50l)     u_query = models.charfield(max_length=500l)     sent_to = models.charfield(max_length=500l)     date_time = models.datetimefield()     is_reply = models.integerfield()     is_responded = models.integerfield()     from_gingr = models.integerfield()     diff = models.integerfield()     class meta:         db_table = 'web_query'  class webreply(models.model):     reply_id = models.integerfield(primary_key=true)     query_id = models.bigintegerfield()     conversation_id = models.charfield(max_length=50l)     b_id = models.charfield(max_length=20l)     u_query = models.charfield(max_length=500l)     user_id = models.charfield(max_length=20l)     date_time = models.datetimefield()     diff = models.integerfield()     class meta:         db_table = 'web_reply'  class webusers(models.model):     user_id = models.bigintegerfield(primary_key=true)     username = models.charfield(max_length=20l)     fb_token = models.charfield(max_length=1000l)     email = models.charfield(max_length=50l)     facebook = models.charfield(max_length=50l)     fb_likes = models.textfield()     twitter = models.charfield(max_length=50l)     gmail = models.charfield(max_length=50l)     gcm_id = models.charfield(max_length=1000l)     date_time = models.datetimefield()     last_login = models.datetimefield()     class meta:         db_table = 'web_users' 

moreover, when typed command manage.py sql api , shows tables. it???

kindly help!!!

the main difference firing manage.py sql myapphere show queries used create schema database, while ouput of myapp.objects.all() return list of entries in database.

for example, if had list of articles, manage.py sql command show myapp properties while myapp.objects.all() show instances of myapp in database.

to further extrapolate problem, try opening db client , make sure column names match ones described in model. if don't match up, might need drop table , resync database (i had problem).


Comments