zoukankan      html  css  js  c++  java
  • sqlalchemy.exc.ProgrammingError: (_mysql_exceptions.ProgrammingError) (1146, "Table 'xxx.authority' doesn't exist")

    • 操作

      • 我是在写项目中把全部的表都删了, 然后进行新建
      if __name__ == '__main__':
          db.create_all()
      
      
    • 报错内容

      The above exception was the direct cause of the following exception:
      
      Traceback (most recent call last):
           省略...............
      File "XXXappadminforms.py", line 10, in <module>
          authority_list = [(v.id, v.name) for v in Authority.query.all()]
           省略...............
      sqlalchemy.exc.ProgrammingError: (_mysql_exceptions.ProgrammingError) (1146, "Table 'xxx.authority' doesn't exist") [SQL: 'SELECT authority.id AS authority_id, authority.name AS authority_name, authority.url AS authority_url, authority.add_time AS authority_add_time 
      FROM authority'] (Background on this error at: http://sqlalche.me/e/f405)
      
      Process finished with exit code 1
      
    • 分析

      • 我们可以从上述内容中知道他是,表不存在,然而他却在forms.py先进行查询, emmmmmmm
    • 解决方法

      • 在forms.py中先将查询部分注释, 执行完db.creat_all()后,再去掉注释
      authority_list = []
      #authority_list = [(v.id, v.name) for v in Authority.query.all()]
      
  • 相关阅读:
    Laravel update某一字段值为另一字段值
    Layui 批量
    CI 框架多表关联查询
    PHP数组函数
    PHP固定长度字符串
    PHP常用方法汇总
    CI 框架批量添加数据(如果数据库有就更新数据)
    使用nginx-http-concat优化网站响应
    mysql自动化安装
    SQL迁移到ORACLE实例
  • 原文地址:https://www.cnblogs.com/edhg/p/8931845.html
Copyright © 2011-2022 走看看