gunthercox / ChatterBot

ChatterBot is a machine learning, conversational dialog engine for creating chat bots
https://chatterbot.readthedocs.io
BSD 3-Clause "New" or "Revised" License
14.1k stars 4.45k forks source link

sqlite3.OperationalError: table statement has no column named search_text #1578

Closed po95-backup closed 5 years ago

po95-backup commented 5 years ago

I have already the gone through the issue stated here ( https://github.com/gunthercox/ChatterBot/issues/1493 ), but it didn't work for me. I am using chatterbot of version = 1.0.0.a2

Can anyone provide any help to fix this issue. Sorry, for stating the whole error list.

`List Trainer: [##                  ] 10%Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x037F5B28>
Traceback (most recent call last):
  File "C:\Users\QA System\AppData\Local\Programs\Python\Python37-32\lib\site-packages\sqlalchemy\engine\base.py", line 1230, in _execute_context
    cursor, statement, parameters, context
  File "C:\Users\QA System\AppData\Local\Programs\Python\Python37-32\lib\site-packages\sqlalchemy\engine\default.py", line 536, in do_execute
    cursor.execute(statement, parameters)
sqlite3.OperationalError: table statement has no column named conversation

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\QA System\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\utils\autoreload.py", line 225, in wrapper
    fn(*args, **kwargs)
  File "C:\Users\QA System\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\core\management\commands\runserver.py", line 117, in inner_run
    self.check(display_num_errors=True)
  File "C:\Users\QA System\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\core\management\base.py", line 379, in check
    include_deployment_checks=include_deployment_checks,
  File "C:\Users\QA System\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\core\management\base.py", line 366, in _run_checks
    return checks.run_checks(**kwargs)
  File "C:\Users\QA System\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\core\checks\registry.py", line 71, in run_checks
    new_errors = check(app_configs=app_configs)
  File "C:\Users\QA System\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\core\checks\urls.py", line 13, in check_url_config
    return check_resolver(resolver)
  File "C:\Users\QA System\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\core\checks\urls.py", line 23, in check_resolver
    return check_method()
  File "C:\Users\QA System\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\urls\resolvers.py", line 396, in check
    for pattern in self.url_patterns:
  File "C:\Users\QA System\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\utils\functional.py", line 37, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "C:\Users\QA System\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\urls\resolvers.py", line 533, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "C:\Users\QA System\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\utils\functional.py", line 37, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "C:\Users\QA System\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\urls\resolvers.py", line 526, in urlconf_module
    return import_module(self.urlconf_name)
  File "C:\Users\QA System\AppData\Local\Programs\Python\Python37-32\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "E:\Final Thesis work\targeted\chat_app\chat_app\urls.py", line 21, in <module>
    url(r'^', include('alpha.urls')),
  File "C:\Users\QA System\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\urls\conf.py", line 34, in include
    urlconf_module = import_module(urlconf_module)
  File "C:\Users\QA System\AppData\Local\Programs\Python\Python37-32\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "E:\Final Thesis work\targeted\chat_app\alpha\urls.py", line 3, in <module>
    from . import views
  File "E:\Final Thesis work\targeted\chat_app\alpha\views.py", line 17, in <module>
    trainer.train(conv)
  File "C:\Users\QA System\AppData\Local\Programs\Python\Python37-32\lib\site-packages\chatterbot\trainers.py", line 97, in train
    tags=statement.tags
  File "C:\Users\QA System\AppData\Local\Programs\Python\Python37-32\lib\site-packages\chatterbot\storage\sql_storage.py", line 189, in create
    session.flush()
  File "C:\Users\QA System\AppData\Local\Programs\Python\Python37-32\lib\site-packages\sqlalchemy\orm\session.py", line 2424, in flush
    self._flush(objects)
  File "C:\Users\QA System\AppData\Local\Programs\Python\Python37-32\lib\site-packages\sqlalchemy\orm\session.py", line 2562, in _flush
    transaction.rollback(_capture_exception=True)
  File "C:\Users\QA System\AppData\Local\Programs\Python\Python37-32\lib\site-packages\sqlalchemy\util\langhelpers.py", line 67, in __exit__
    compat.reraise(exc_type, exc_value, exc_tb)
  File "C:\Users\QA System\AppData\Local\Programs\Python\Python37-32\lib\site-packages\sqlalchemy\util\compat.py", line 277, in reraise
    raise value
  File "C:\Users\QA System\AppData\Local\Programs\Python\Python37-32\lib\site-packages\sqlalchemy\orm\session.py", line 2522, in _flush
    flush_context.execute()
  File "C:\Users\QA System\AppData\Local\Programs\Python\Python37-32\lib\site-packages\sqlalchemy\orm\unitofwork.py", line 416, in execute
    rec.execute(self)
  File "C:\Users\QA System\AppData\Local\Programs\Python\Python37-32\lib\site-packages\sqlalchemy\orm\unitofwork.py", line 583, in execute
    uow,
  File "C:\Users\QA System\AppData\Local\Programs\Python\Python37-32\lib\site-packages\sqlalchemy\orm\persistence.py", line 245, in save_obj
    insert,
  File "C:\Users\QA System\AppData\Local\Programs\Python\Python37-32\lib\site-packages\sqlalchemy\orm\persistence.py", line 1116, in _emit_insert_statements
    statement, params
  File "C:\Users\QA System\AppData\Local\Programs\Python\Python37-32\lib\site-packages\sqlalchemy\engine\base.py", line 974, in execute
    return meth(self, multiparams, params)
  File "C:\Users\QA System\AppData\Local\Programs\Python\Python37-32\lib\site-packages\sqlalchemy\sql\elements.py", line 273, in _execute_on_connection
    return connection._execute_clauseelement(self, multiparams, params)
  File "C:\Users\QA System\AppData\Local\Programs\Python\Python37-32\lib\site-packages\sqlalchemy\engine\base.py", line 1093, in _execute_clauseelement
    distilled_params,
  File "C:\Users\QA System\AppData\Local\Programs\Python\Python37-32\lib\site-packages\sqlalchemy\engine\base.py", line 1234, in _execute_context
    e, statement, parameters, cursor, context
  File "C:\Users\QA System\AppData\Local\Programs\Python\Python37-32\lib\site-packages\sqlalchemy\engine\base.py", line 1452, in _handle_dbapi_exception
    util.raise_from_cause(sqlalchemy_exception, exc_info)
  File "C:\Users\QA System\AppData\Local\Programs\Python\Python37-32\lib\site-packages\sqlalchemy\util\compat.py", line 296, in raise_from_cause
    reraise(type(exception), exception, tb=exc_tb, cause=cause)
  File "C:\Users\QA System\AppData\Local\Programs\Python\Python37-32\lib\site-packages\sqlalchemy\util\compat.py", line 276, in reraise
    raise value.with_traceback(tb)
  File "C:\Users\QA System\AppData\Local\Programs\Python\Python37-32\lib\site-packages\sqlalchemy\engine\base.py", line 1230, in _execute_context
    cursor, statement, parameters, context
  File "C:\Users\QA System\AppData\Local\Programs\Python\Python37-32\lib\site-packages\sqlalchemy\engine\default.py", line 536, in do_execute
    cursor.execute(statement, parameters)
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) table statement has no column named conversation [SQL: 'INSERT INTO statement (text, conversation, in_response_to, persona) VALUES (?, ?, ?, ?)'] [parameters: ('\ufeffকেউ কি কখনো চাঁদের মালিক হতে পারবে?', 'training', None, None)] (Background on this error at: http://sqlalche.me/e/e3q8)`
sarangjain40 commented 5 years ago

Even I am facing the same issue. while executing https://github.com/gunthercox/ChatterBot/blob/master/examples/learning_feedback_example.py, I got similar error OperationalError: (sqlite3.OperationalError) no such column: statement.search_text.

I am on version 1.0.0a4

sarangjain40 commented 5 years ago

Its working for me. Uninstalled, removed sqlite3.file and reinstalled 1.0.0 build and its working. Thankx

gunthercox commented 5 years ago

@sarangjain40 I'm glad to hear your issue was resolved.

devrajlin commented 5 years ago

I'm also getting the same error

@gunthercox can you please help me with this error cause since the day i started this chatterbot code im getting multiple errors and spent a day with this errors.

[nltk_data] Downloading package averaged_perceptron_tagger to [nltk_data] /home/devraj/nltk_data... [nltk_data] Package averaged_perceptron_tagger is already up-to- [nltk_data] date! [nltk_data] Downloading package stopwords to /home/devraj/nltk_data... [nltk_data] Package stopwords is already up-to-date! [nltk_data] Downloading package punkt to /home/devraj/nltk_data... [nltk_data] Package punkt is already up-to-date! List Trainer: [####################] 100% Traceback (most recent call last): File "/home/devraj/Downloads/Chatbot_Project-master/venv/lib/python3.5/site-packages/sqlalchemy/engine/base.py", line 1236, in _execute_context cursor, statement, parameters, context File "/home/devraj/Downloads/Chatbot_Project-master/venv/lib/python3.5/site-packages/sqlalchemy/engine/default.py", line 536, in do_execute cursor.execute(statement, parameters) sqlite3.OperationalError: table statement has no column named search_text

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "chatbot_train.py", line 10, in trainer.train(conv) File "/home/devraj/Downloads/Chatbot_Project-master/venv/lib/python3.5/site-packages/chatterbot/trainers.py", line 120, in train self.chatbot.storage.create_many(statements_to_create) File "/home/devraj/Downloads/Chatbot_Project-master/venv/lib/python3.5/site-packages/chatterbot/storage/sql_storage.py", line 267, in create_many session.commit() File "/home/devraj/Downloads/Chatbot_Project-master/venv/lib/python3.5/site-packages/sqlalchemy/orm/session.py", line 1023, in commit self.transaction.commit() File "/home/devraj/Downloads/Chatbot_Project-master/venv/lib/python3.5/site-packages/sqlalchemy/orm/session.py", line 487, in commit self._prepare_impl() File "/home/devraj/Downloads/Chatbot_Project-master/venv/lib/python3.5/site-packages/sqlalchemy/orm/session.py", line 466, in _prepare_impl self.session.flush() File "/home/devraj/Downloads/Chatbot_Project-master/venv/lib/python3.5/site-packages/sqlalchemy/orm/session.py", line 2436, in flush self._flush(objects) File "/home/devraj/Downloads/Chatbot_Project-master/venv/lib/python3.5/site-packages/sqlalchemy/orm/session.py", line 2574, in _flush transaction.rollback(_capture_exception=True) File "/home/devraj/Downloads/Chatbot_Project-master/venv/lib/python3.5/site-packages/sqlalchemy/util/langhelpers.py", line 67, in exit compat.reraise(exc_type, exc_value, exc_tb) File "/home/devraj/Downloads/Chatbot_Project-master/venv/lib/python3.5/site-packages/sqlalchemy/util/compat.py", line 277, in reraise raise value File "/home/devraj/Downloads/Chatbot_Project-master/venv/lib/python3.5/site-packages/sqlalchemy/orm/session.py", line 2534, in _flush flush_context.execute() File "/home/devraj/Downloads/Chatbot_Project-master/venv/lib/python3.5/site-packages/sqlalchemy/orm/unitofwork.py", line 416, in execute rec.execute(self) File "/home/devraj/Downloads/Chatbot_Project-master/venv/lib/python3.5/site-packages/sqlalchemy/orm/unitofwork.py", line 583, in execute uow, File "/home/devraj/Downloads/Chatbot_Project-master/venv/lib/python3.5/site-packages/sqlalchemy/orm/persistence.py", line 245, in save_obj insert, File "/home/devraj/Downloads/Chatbot_Project-master/venv/lib/python3.5/site-packages/sqlalchemy/orm/persistence.py", line 1116, in _emit_insert_statements statement, params File "/home/devraj/Downloads/Chatbot_Project-master/venv/lib/python3.5/site-packages/sqlalchemy/engine/base.py", line 980, in execute return meth(self, multiparams, params) File "/home/devraj/Downloads/Chatbot_Project-master/venv/lib/python3.5/site-packages/sqlalchemy/sql/elements.py", line 273, in _execute_on_connection return connection._execute_clauseelement(self, multiparams, params) File "/home/devraj/Downloads/Chatbot_Project-master/venv/lib/python3.5/site-packages/sqlalchemy/engine/base.py", line 1099, in _execute_clauseelement distilled_params, File "/home/devraj/Downloads/Chatbot_Project-master/venv/lib/python3.5/site-packages/sqlalchemy/engine/base.py", line 1240, in _execute_context e, statement, parameters, cursor, context File "/home/devraj/Downloads/Chatbot_Project-master/venv/lib/python3.5/site-packages/sqlalchemy/engine/base.py", line 1458, in _handle_dbapi_exception util.raise_from_cause(sqlalchemy_exception, exc_info) File "/home/devraj/Downloads/Chatbot_Project-master/venv/lib/python3.5/site-packages/sqlalchemy/util/compat.py", line 296, in raise_from_cause reraise(type(exception), exception, tb=exc_tb, cause=cause) File "/home/devraj/Downloads/Chatbot_Project-master/venv/lib/python3.5/site-packages/sqlalchemy/util/compat.py", line 276, in reraise raise value.with_traceback(tb) File "/home/devraj/Downloads/Chatbot_Project-master/venv/lib/python3.5/site-packages/sqlalchemy/engine/base.py", line 1236, in _execute_context cursor, statement, parameters, context File "/home/devraj/Downloads/Chatbot_Project-master/venv/lib/python3.5/site-packages/sqlalchemy/engine/default.py", line 536, in do_execute cursor.execute(statement, parameters) sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) table statement has no column named search_text [SQL: 'INSERT INTO statement (text, search_text, conversation, created_at, in_response_to, search_in_response_to, persona) VALUES (?, ?, ?, ?, ?, ?, ?)'] [parameters: ('hi', 'hi', 'training', '2019-02-01 13:47:11.940888', None, '', '')] (Background on this error at: http://sqlalche.me/e/e3q8)

po95-backup commented 5 years ago

Delete the sqlite3 file that has been created in your previous code and run the code again. It will work probably.

devrajlin commented 5 years ago

@po95 yeah sure man! but instead of deleting that we can upgrade chatterbot to new version pip install --upgrade chatterbot==0.7.4. It solved all my errors and its working properly. For any module errors please upgrade your chatterbot to this version. @gunthercox thanks for your amazing work man!

po95-backup commented 5 years ago

You will face problem for the old versions of chatterbot for a large dataset. For large dataset and immediate response, use 1.0.0 version or later. Thanks

devrajlin commented 5 years ago

@po95 ohh!! can you give the clear and exact solution for sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) with terminal commands so that i can improve my code better in future. Thank you.

lock[bot] commented 4 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.