superset: Error while running superset db upgrade

I am trying to install apache superset and got an error while running superset db upgrade command

How to reproduce the bug

  1. Open/create virtual environment with linux
  2. Then install the superset
  3. After that upgrade the db by the command: superset db upgrade

Expected results

I am expecting that by running the command superset db upgrade the database will load some sample data

Actual results

getting error saying that AttributeError: module ‘sqlparse.keywords’ has no attribute ‘FLAGS’ Error: Traceback (most recent call last): File “/root/supersetdata/bin/superset”, line 5, in <module> from superset.cli.main import superset File “/root/supersetdata/lib/python3.10/site-packages/superset/init.py”, line 21, in <module> from superset.app import create_app File “/root/supersetdata/lib/python3.10/site-packages/superset/app.py”, line 23, in <module> from superset.initialization import SupersetAppInitializer File “/root/supersetdata/lib/python3.10/site-packages/superset/initialization/init.py”, line 33, in <module> from superset.extensions import ( File “/root/supersetdata/lib/python3.10/site-packages/superset/extensions/init.py”, line 32, in <module> from superset.utils.async_query_manager import AsyncQueryManager File “/root/supersetdata/lib/python3.10/site-packages/superset/utils/async_query_manager.py”, line 26, in <module> from superset.utils.core import get_user_id File “/root/supersetdata/lib/python3.10/site-packages/superset/utils/core.py”, line 106, in <module> from superset.sql_parse import sanitize_clause File “/root/supersetdata/lib/python3.10/site-packages/superset/sql_parse.py”, line 67, in <module> re.compile(r"‘(’‘|\\|\|[^’])*'", sqlparse.keywords.FLAGS).match, AttributeError: module ‘sqlparse.keywords’ has no attribute ‘FLAGS’

Screenshots

image

Environment

(please complete the following information):

  • browser type and version: I am running in python virtual env
  • superset version: 1.4
  • python version: 3.10.6
  • node.js version: NA
  • any feature flags active: no

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 20 (3 by maintainers)

Most upvoted comments

The problem is probably due to your sqlparse version just try out pip install sqlparse=='0.4.3' , it should work after it

Thanks for the help I ran the sqlparse version command and after that I again tried superset db upgrade command and got below error:

Error: Could not locate a Flask application. You did not provide the “FLASK_APP” environment variable, and a “wsgi.py” or “app.py” module was not found in the current directory.

anything I am missing?

you need to setup your flask app

export FLASK_APP=superset # on Ubuntu
set FLASK_APP=superset # on windows

it it doesn’t work, then you need to try out

$env:FLASK_APP="SupersetPath\Superset\Lib\site-packages\superset\app.py"

Please do not mention random nicknames: if everybody does that, superset users and contributors would get flooded with non-relevant notifications. I would also suggest copying and paste text instead of screenshot it, as that makes it less readable.

We haven’t found any Content Security Policy (CSP)

I don’t see any error, CSP is a warning, you can understand it more by reading https://superset.apache.org/docs/security/#content-security-policy-csp

Regarding Caching, it’s another warning that you didn’t configure any caching, I use redis on my ubuntu, setting it up is easy and on the official documentation you can configure it https://superset.apache.org/docs/installation/cache

Anyway, your Superset works even with ignoring those two warnings, but it’s preferable to setup a caching system, and it might be preferable to setup CSP in case your Superset will get public access.