SQLAlchemy IO和操作错误

时间:2019-05-16 06:41:14

标签: mysql sql sqlalchemy ubuntu-18.04 windows-subsystem-for-linux

我将Ubuntu 18.04用作WSL(Linux的Windows子系统)的一部分。python版本是2.7,而sqlalchemy版本是0.7,这是python包pele(https://github.com/pele-python/pele)所必需的。在运行调用pele库的脚本时,我从sqlalchemy中收到IOError。

当我按照上一个错误的建议进行操作时,出现错误: sqlalchemy.exc.OperationalError:(OperationalError)没有这样的表:tbl_minima'ALTER TABLE tbl_minima ADD fvib FLOAT;' ()。

The first error is below:

Traceback (most recent call last):
  File "bh.py", line 4, in <module>
    database=system.create_database('lj17.sqlite')
  File "/home/gn203/.local/lib/python2.7/site-
packages/pele/systems/basesystem.py", line 234, in create_database
    db = Database(**kwargs)
  File "/home/gn203/.local/lib/python2.7/site-packages/pele/storage/database.py", line 432, in __init__
    self._check_schema_version()
  File "/home/gn203/.local/lib/python2.7/site-packages/pele/storage/database.py", line 477, in _check_schema_version
    "%d (%d). Please use migrate_db.py in pele/scripts to update database"%(schema, _schema_version))
IOError: database schema outdated, current (newest) version: 0 (2). Please use migrate_db.py``` 

```Second error is below:```

```lj17.sqlite
current version: 0
newest version: 2
migrating from database version 0 to 1
Traceback (most recent call last):
  File "/home/gn203/pkg/pele-master/scripts/migrate_db.py", line 63, in <module>
    migrate(dbfile)
  File "/home/gn203/pkg/pele-master/scripts/migrate_db.py", line 47, in migrate
    schema = migrate_script[schema](connection, schema)
  File "/home/gn203/pkg/pele-master/scripts/migrate_db.py", line 13, in from_0_to_1
    connection.execute("ALTER TABLE tbl_minima ADD fvib FLOAT;")
  File "/home/gn203/.local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1294, in execute
    params)
  File "/home/gn203/.local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1471, in _execute_text
    statement, parameters
  File "/home/gn203/.local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1535, in _execute_context
    context)
  File "/home/gn203/.local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1528, in _execute_context
    context)
  File "/home/gn203/.local/lib/python2.7/site-packages/sqlalchemy/engine/default.py", line 325, in do_execute
    cursor.execute(statement, parameters)
sqlalchemy.exc.OperationalError: (OperationalError) no such table: tbl_minima 'ALTER TABLE tbl_minima ADD fvib FLOAT;' ()```

0 个答案:

没有答案