sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) no such table: css_templates

报错

  File "/home/as/anaconda3/envs/superset/lib/python3.4/site-packages/sqlalchemy/orm/query.py", line 2855, in __iter__
    return self._execute_and_instances(context)
  File "/home/as/anaconda3/envs/superset/lib/python3.4/site-packages/sqlalchemy/orm/query.py", line 2878, in _execute_and_instances
    result = conn.execute(querycontext.statement, self._params)
  File "/home/as/anaconda3/envs/superset/lib/python3.4/site-packages/sqlalchemy/engine/base.py", line 945, in execute
    return meth(self, multiparams, params)
  File "/home/as/anaconda3/envs/superset/lib/python3.4/site-packages/sqlalchemy/sql/elements.py", line 263, in _execute_on_connection
    return connection._execute_clauseelement(self, multiparams, params)
  File "/home/as/anaconda3/envs/superset/lib/python3.4/site-packages/sqlalchemy/engine/base.py", line 1053, in _execute_clauseelement
    compiled_sql, distilled_params
  File "/home/as/anaconda3/envs/superset/lib/python3.4/site-packages/sqlalchemy/engine/base.py", line 1189, in _execute_context
    context)
  File "/home/as/anaconda3/envs/superset/lib/python3.4/site-packages/sqlalchemy/engine/base.py", line 1402, in _handle_dbapi_exception
    exc_info
  File "/home/as/anaconda3/envs/superset/lib/python3.4/site-packages/sqlalchemy/util/compat.py", line 203, in raise_from_cause
    reraise(type(exception), exception, tb=exc_tb, cause=cause)
  File "/home/as/anaconda3/envs/superset/lib/python3.4/site-packages/sqlalchemy/util/compat.py", line 186, in reraise
    raise value.with_traceback(tb)
  File "/home/as/anaconda3/envs/superset/lib/python3.4/site-packages/sqlalchemy/engine/base.py", line 1182, in _execute_context
    context)
  File "/home/as/anaconda3/envs/superset/lib/python3.4/site-packages/sqlalchemy/engine/default.py", line 470, in do_execute
    cursor.execute(statement, parameters)
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) no such table: css_templates [SQL: 'SELECT css_templates.created_on AS css_templates_created_on, css_templates.changed_on AS css_templates_changed_on, css_templates.id AS css_templates_id, css_templates.template_name AS css_templates_template_name, css_templates.css AS css_templates_css, css_templates.changed_by_fk AS css_templates_changed_by_fk, css_templates.created_by_fk AS css_templates_created_by_fk \nFROM css_templates \nWHERE css_templates.template_name = ?\n LIMIT ? OFFSET ?'] [parameters: ('Flat', 1, 0)]

解决
python脚本无法找到SQLLife文件,正确设置文件路径就能解决
由于我之前没怎么接触过数据库(sqlite),不知道在哪修改文件路径,所以我将superset连接到其他数据库(mysql)
到superset目录下找到配置文件config.py
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) no such table: css_templates_第1张图片
在红色标记处修改即可

你可能感兴趣的:(数据库,Python,报错)