Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(1146, "Table 'sale.predict_product' doesn't exist") #4

Open
RahulKumarSavariya opened this issue Nov 28, 2019 · 3 comments
Open

(1146, "Table 'sale.predict_product' doesn't exist") #4

RahulKumarSavariya opened this issue Nov 28, 2019 · 3 comments

Comments

@RahulKumarSavariya
Copy link

I click on the predict button in the product form. After that i receive this error. Any solution for that..
django == 2.2.5

▶ Local vars
/home/emxcel/anaconda3/envs/oenv/lib/python3.6/site-packages/django/db/backends/mysql/base.py in execute
return self.cursor.execute(query, args) …
▶ Local vars
/home/emxcel/anaconda3/envs/oenv/lib/python3.6/site-packages/MySQLdb/cursors.py in execute
res = self._query(query) …
▶ Local vars
/home/emxcel/anaconda3/envs/oenv/lib/python3.6/site-packages/MySQLdb/cursors.py in _query
db.query(q) …
▶ Local vars
/home/emxcel/anaconda3/envs/oenv/lib/python3.6/site-packages/MySQLdb/connections.py in query
_mysql.connection.query(self, query) …
▶ Local vars
The above exception ((1146, "Table 'sale.predict_product' doesn't exist")) was the direct cause of the following exception:
/home/emxcel/anaconda3/envs/oenv/lib/python3.6/site-packages/django/core/handlers/exception.py in inner
response = get_response(request) …
▶ Local vars
/home/emxcel/anaconda3/envs/oenv/lib/python3.6/site-packages/django/core/handlers/base.py in _get_response
response = self.process_exception_by_middleware(e, request) …
▶ Local vars
/home/emxcel/anaconda3/envs/oenv/lib/python3.6/site-packages/django/core/handlers/base.py in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs) …
▶ Local vars
/home/emxcel/Projects_python/sales-forecast-ml-master/predict/views.py in product_describe_view
product_detail = product_form.save() …
▶ Local vars
/home/emxcel/Projects_python/sales-forecast-ml-master/predict/forms.py in save
product.save() …
▶ Local vars
/home/emxcel/anaconda3/envs/oenv/lib/python3.6/site-packages/django/db/models/base.py in save
force_update=force_update, update_fields=update_fields) …
▶ Local vars
/home/emxcel/anaconda3/envs/oenv/lib/python3.6/site-packages/django/db/models/base.py in save_base
force_update, using, update_fields, …
▶ Local vars
/home/emxcel/anaconda3/envs/oenv/lib/python3.6/site-packages/django/db/models/base.py in _save_table
result = self._do_insert(cls._base_manager, using, fields, update_pk, raw) …
▶ Local vars
/home/emxcel/anaconda3/envs/oenv/lib/python3.6/site-packages/django/db/models/base.py in _do_insert
using=using, raw=raw) …
▶ Local vars
/home/emxcel/anaconda3/envs/oenv/lib/python3.6/site-packages/django/db/models/manager.py in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs) …
▶ Local vars
/home/emxcel/anaconda3/envs/oenv/lib/python3.6/site-packages/django/db/models/query.py in _insert
return query.get_compiler(using=using).execute_sql(return_id) …
▶ Local vars
/home/emxcel/anaconda3/envs/oenv/lib/python3.6/site-packages/django/db/models/sql/compiler.py in execute_sql
cursor.execute(sql, params) …
▶ Local vars
/home/emxcel/anaconda3/envs/oenv/lib/python3.6/site-packages/django/db/backends/utils.py in execute
return super().execute(sql, params) …
▶ Local vars
/home/emxcel/anaconda3/envs/oenv/lib/python3.6/site-packages/django/db/backends/utils.py in execute
return self._execute_with_wrappers(sql, params, many=False, executor=self._execute) …
▶ Local vars
/home/emxcel/anaconda3/envs/oenv/lib/python3.6/site-packages/django/db/backends/utils.py in _execute_with_wrappers
return executor(sql, params, many, context) …
▶ Local vars
/home/emxcel/anaconda3/envs/oenv/lib/python3.6/site-packages/django/db/backends/utils.py in _execute
return self.cursor.execute(sql, params) …
▶ Local vars
/home/emxcel/anaconda3/envs/oenv/lib/python3.6/site-packages/django/db/utils.py in exit
raise dj_exc_value.with_traceback(traceback) from exc_value …
▶ Local vars
/home/emxcel/anaconda3/envs/oenv/lib/python3.6/site-packages/django/db/backends/utils.py in _execute
return self.cursor.execute(sql, params) …
▶ Local vars
/home/emxcel/anaconda3/envs/oenv/lib/python3.6/site-packages/django/db/backends/mysql/base.py in execute
return self.cursor.execute(query, args) …
▶ Local vars
/home/emxcel/anaconda3/envs/oenv/lib/python3.6/site-packages/MySQLdb/cursors.py in execute
res = self._query(query) …
▶ Local vars
/home/emxcel/anaconda3/envs/oenv/lib/python3.6/site-packages/MySQLdb/cursors.py in _query
db.query(q) …
▶ Local vars
/home/emxcel/anaconda3/envs/oenv/lib/python3.6/site-packages/MySQLdb/connections.py in query
_mysql.connection.query(self, query) …
▶ Local vars

@rshrc
Copy link
Owner

rshrc commented Dec 1, 2019

Hello @RahulKumarSavariya it seems to be a migration error. Did you run the migrations commands?
The above exception ((1146, "Table 'sale.predict_product' doesn't exist")) this error means that the table was not created in the first place.

@RahulKumarSavariya
Copy link
Author

Thanks @rshrc . Actually i didn't write the app name in migration command. After, click the predict button, i received the error "(1048, "Column 'predict_product' cannot be null") ". I modify the predict_product column null and blank to true. Can you explain it why ?
My_sql_predict

@rshrc
Copy link
Owner

rshrc commented Dec 6, 2019

Yes, the migration problem is with the django version. It does not migrate the apps with python manage.py makemigrations

You need to run python manage.py makemigrations predict

This should create the predict.product table

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants