WeiXiaozhai 2022-03-22 17:25 采纳率: 100%
浏览 97
已结题

迁移脚本应用到数据库时,发生错误


(venv) G:\Travel>python manage.py db upgrade
Traceback (most recent call last):
  File "manage.py", line 3, in <module>
    from app.models import *
  File "G:\Travel\app\models.py", line 5, in <module>
    class User(db.Model):
  File "G:\Travel\venv\lib\site-packages\flask_sqlalchemy\model.py", line 67, in __init__
    super(NameMetaMixin, cls).__init__(name, bases, d)
  File "G:\Travel\venv\lib\site-packages\flask_sqlalchemy\model.py", line 121, in __init__
    super(BindMetaMixin, cls).__init__(name, bases, d)
  File "G:\Travel\venv\lib\site-packages\sqlalchemy\orm\decl_api.py", line 72, in __init__
    _as_declarative(reg, cls, dict_)
  File "G:\Travel\venv\lib\site-packages\sqlalchemy\orm\decl_base.py", line 126, in _as_declarative
    return _MapperConfig.setup_mapping(registry, cls, dict_, None, {})
  File "G:\Travel\venv\lib\site-packages\sqlalchemy\orm\decl_base.py", line 177, in setup_mapping
    return cfg_cls(registry, cls_, dict_, table, mapper_kw)
  File "G:\Travel\venv\lib\site-packages\sqlalchemy\orm\decl_base.py", line 322, in __init__
    self._setup_table(table)
  File "G:\Travel\venv\lib\site-packages\sqlalchemy\orm\decl_base.py", line 815, in _setup_table
    **table_kw
  File "G:\Travel\venv\lib\site-packages\flask_sqlalchemy\model.py", line 99, in __table_cls__
    return sa.Table(*args, **kwargs)
  File "<string>", line 2, in __new__
  File "G:\Travel\venv\lib\site-packages\sqlalchemy\util\deprecations.py", line 309, in warned
    return fn(*args, **kwargs)
  File "G:\Travel\venv\lib\site-packages\sqlalchemy\sql\schema.py", line 607, in __new__
    metadata._remove_table(name, schema)
  File "G:\Travel\venv\lib\site-packages\sqlalchemy\util\langhelpers.py", line 72, in __exit__
    with_traceback=exc_tb,
  File "G:\Travel\venv\lib\site-packages\sqlalchemy\util\compat.py", line 207, in raise_
    raise exception
  File "G:\Travel\venv\lib\site-packages\sqlalchemy\sql\schema.py", line 602, in __new__
    table._init(name, metadata, *args, **kw)
  File "G:\Travel\venv\lib\site-packages\sqlalchemy\sql\schema.py", line 671, in _init
    self._extra_kwargs(**kwargs)
  File "G:\Travel\venv\lib\site-packages\sqlalchemy\sql\schema.py", line 807, in _extra_kwargs
    self._validate_dialect_kwargs(kwargs)
  File "G:\Travel\venv\lib\site-packages\sqlalchemy\sql\base.py", line 426, in _validate_dialect_kwargs
    "named <dialectname>_<argument>, got '%s'" % k
TypeError: Additional arguments should be named <dialectname>_<argument>, got 'useexisting'
  • 写回答

1条回答 默认 最新

  • Q199711 2022-03-26 22:51
    关注

    降低flask_sqlalchemy、sqlalchemy这两个的版本,Flask-SQLAlchemy ==2.3.2,SQLAlchemy==1.2.4

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

问题事件

  • 系统已结题 5月5日
  • 已采纳回答 4月27日
  • 创建了问题 3月22日

悬赏问题

  • ¥15 android tv图标显示异常
  • ¥20 (标签-AR|关键词-预测分析)
  • ¥15 MATLAB矩阵分离问题
  • ¥15 QT IFW 自定义界面添加lineedit小键盘输入数字无效果
  • ¥15 python thinter动态建立Entry并读取数据
  • ¥150 电路仿真,演示反激变压器升压
  • ¥100 libcurl使用无法连接服务器问题
  • ¥30 链表栈表达式求值求解
  • ¥15 关于龙芯1b,JTAG停止调试服务
  • ¥15 求一个图片中的成交量选股公式