RasaHQ / rasa

💬 Open source machine learning framework to automate text- and voice-based conversations: NLU, dialogue management, connect to Slack, Facebook, and more - Create chatbots and voice assistants
https://rasa.com/docs/rasa/
Apache License 2.0
18.94k stars 4.64k forks source link

Rasa X - Migration database error #4733

Closed DiegoProtec closed 5 years ago

DiegoProtec commented 5 years ago

Rasa version:1.4.3

Rasa X version:0.22.1

Python version:3.6

Operating system:windows

Issue: The Rasa X can't finish the database migration to oracle.

Error (including full traceback):

Traceback (most recent call last):
  File "C:\Program Files\Python36\lib\site-packages\sqlalchemy\engine\base.py", line 1244, in _execute_context
    cursor, statement, parameters, context
  File "C:\Program Files\Python36\lib\site-packages\sqlalchemy\engine\default.py", line 552, in do_execute
    cursor.execute(statement, parameters)
cx_Oracle.DatabaseError: ORA-00906: parentese esquerdo n?o encontrado

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

Traceback (most recent call last):
  File "migrate_tracker.py", line 220, in <module>
    args.max_trackers,
  File "migrate_tracker.py", line 102, in _migrate_tracker_store_to_rasa_x
    sql_migrations.run_migrations(db_session)
  File "C:\Users\x01214707173\AppData\Roaming\Python\Python36\site-packages\rasax\community\sql_migrations.py", line 25, in run_migrations
    _run_schema_migrations(session)
  File "C:\Users\x01214707173\AppData\Roaming\Python\Python36\site-packages\rasax\community\sql_migrations.py", line 50, in _run_schema_migrations
    command.upgrade(alembic_config, "head")
  File "C:\Program Files\Python36\lib\site-packages\alembic\command.py", line 276, in upgrade
    script.run_env()
  File "C:\Program Files\Python36\lib\site-packages\alembic\script\base.py", line 475, in run_env
    util.load_python_file(self.dir, "env.py")
  File "C:\Program Files\Python36\lib\site-packages\alembic\util\pyfiles.py", line 90, in load_python_file
    module = load_module_py(module_id, path)
  File "C:\Program Files\Python36\lib\site-packages\alembic\util\compat.py", line 177, in load_module_py
    spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "C:\Users\x01214707173\AppData\Roaming\Python\Python36\site-packages\rasax\community\database\schema_migrations\alembic\env.py", line 89, in <module>
    run_migrations_online()
  File "C:\Users\x01214707173\AppData\Roaming\Python\Python36\site-packages\rasax\community\database\schema_migrations\alembic\env.py", line 79, in run_migrations_online
    context.run_migrations()
  File "<string>", line 8, in run_migrations
  File "C:\Program Files\Python36\lib\site-packages\alembic\runtime\environment.py", line 839, in run_migrations
    self.get_context().run_migrations(**kw)
  File "C:\Program Files\Python36\lib\site-packages\alembic\runtime\migration.py", line 362, in run_migrations
    step.migration_fn(**kw)
  File "C:\Users\x01214707173\AppData\Roaming\Python\Python36\site-packages\rasax\community\database\schema_migrations\alembic\versions\migration_2019_08_30_add_unique_id_to_entitysynonyms_d45a0bf21e89.py", line 72, in upgrade
    sa.PrimaryKeyConstraint("id"),
  File "<string>", line 8, in create_table
  File "<string>", line 3, in create_table
  File "C:\Program Files\Python36\lib\site-packages\alembic\operations\ops.py", line 1248, in create_table
    return operations.invoke(op)
  File "C:\Program Files\Python36\lib\site-packages\alembic\operations\base.py", line 345, in invoke
    return fn(self, operation)
  File "C:\Program Files\Python36\lib\site-packages\alembic\operations\toimpl.py", line 101, in create_table
    operations.impl.create_table(table)
  File "C:\Program Files\Python36\lib\site-packages\alembic\ddl\impl.py", line 252, in create_table
    self._exec(schema.CreateTable(table))
  File "C:\Program Files\Python36\lib\site-packages\alembic\ddl\oracle.py", line 30, in _exec
    result = super(OracleImpl, self)._exec(construct, *args, **kw)
  File "C:\Program Files\Python36\lib\site-packages\alembic\ddl\impl.py", line 134, in _exec
    return conn.execute(construct, *multiparams, **params)
  File "C:\Program Files\Python36\lib\site-packages\sqlalchemy\engine\base.py", line 988, in execute
    return meth(self, multiparams, params)
  File "C:\Program Files\Python36\lib\site-packages\sqlalchemy\sql\ddl.py", line 72, in _execute_on_connection
    return connection._execute_ddl(self, multiparams, params)
  File "C:\Program Files\Python36\lib\site-packages\sqlalchemy\engine\base.py", line 1050, in _execute_ddl
    compiled,
  File "C:\Program Files\Python36\lib\site-packages\sqlalchemy\engine\base.py", line 1248, in _execute_context
    e, statement, parameters, cursor, context
  File "C:\Program Files\Python36\lib\site-packages\sqlalchemy\engine\base.py", line 1466, in _handle_dbapi_exception
    util.raise_from_cause(sqlalchemy_exception, exc_info)
  File "C:\Program Files\Python36\lib\site-packages\sqlalchemy\util\compat.py", line 383, in raise_from_cause
    reraise(type(exception), exception, tb=exc_tb, cause=cause)
  File "C:\Program Files\Python36\lib\site-packages\sqlalchemy\util\compat.py", line 128, in reraise
    raise value.with_traceback(tb)
  File "C:\Program Files\Python36\lib\site-packages\sqlalchemy\engine\base.py", line 1244, in _execute_context
    cursor, statement, parameters, context
  File "C:\Program Files\Python36\lib\site-packages\sqlalchemy\engine\default.py", line 552, in do_execute
    cursor.execute(statement, parameters)
sqlalchemy.exc.DatabaseError: (cx_Oracle.DatabaseError) ORA-00906: left parenthese not found
[SQL:
CREATE TABLE entity_synonym_value (
        id INTEGER NOT NULL,
        entity_synonym_id INTEGER,
        name VARCHAR2,
        PRIMARY KEY (id),
        FOREIGN KEY(entity_synonym_id) REFERENCES entity_synonym (id) ON DELETE cascade
)

]
(Background on this error at: http://sqlalche.me/e/4xp6)

Command or request that led to error:

python -m rasax.community.server
sara-tagger commented 5 years ago

Thanks for raising this issue, @amn41 will get back to you about it soon✨

Please also check out the docs and the forum in case your issue was raised there too 🤗
wochinge commented 5 years ago

Hi @DiegoProtec ,

thanks for raising this issue. We already fixed this and will include this in the next patch release :-) I'll keep it open for now, until we have released the version including this change.

erohmensing commented 5 years ago

Fixed in 0.22.2 🙂

DiegoProtec commented 5 years ago

Images

Problem

I keep getting the error when I run the services, the Rasa X can't finish the database migration, the tables does created but can't import the dataset.

When I run docker-compose, the following error occurs:

rasa-x_1           | [SQL: ALTER TABLE entity_synonym ADD id INTEGER NOT NULL]
rasa-x_1           | (Background on this error at: http://sqlalche.me/e/4xp6)

When I run the "migrate.py", with environment variable "DB_URL":

DB_URL=oracle://admin:admin@localhost:1521/db

occurs this:

sqlalchemy.exc.DatabaseError: (cx_Oracle.DatabaseError) ORA-00936: expression not found
[SQL: select name, synonym from entity_synonym]
(Background on this error at: http://sqlalche.me/e/4xp6)
wochinge commented 5 years ago

@DiegoProtec https://github.com/RasaHQ/rasa/issues/4754 covers your latest comment, right?