Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OperationalError no such table dashboards #3542

Closed
wfowlks opened this issue Sep 27, 2017 · 7 comments
Closed

OperationalError no such table dashboards #3542

wfowlks opened this issue Sep 27, 2017 · 7 comments

Comments

@wfowlks
Copy link

wfowlks commented Sep 27, 2017

  • [*] I have checked the superset logs for python stacktraces and included it here as text if any
  • [*] I have reproduced the issue with at least the latest released version of superset
  • [*] I have checked the issue tracker for the same issue and I haven't found one similar

Superset version

0.19.1

Expected results

After Logging in shows dashboards

Actual results

The correct results show when running server in debug mode:
superset runserver -d
However when running as a server: superset runserver I get the following:
screen shot 2017-09-27 at 3 11 31 pm

Exception on /dashboardmodelviewasync/api/read [GET]
Traceback (most recent call last):
  File "/home/centos/supersets/venv/lib/python2.7/site-packages/flask/app.py", line 1982, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/centos/supersets/venv/lib/python2.7/site-packages/flask/app.py", line 1614, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/centos/supersets/venv/lib/python2.7/site-packages/flask/app.py", line 1517, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/home/centos/supersets/venv/lib/python2.7/site-packages/flask/app.py", line 1612, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/centos/supersets/venv/lib/python2.7/site-packages/flask/app.py", line 1598, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/centos/supersets/venv/lib/python2.7/site-packages/flask_appbuilder/security/decorators.py", line 52, in wraps
    return f(self, *args, **kwargs)
  File "/home/centos/supersets/venv/lib/python2.7/site-packages/flask_appbuilder/views.py", line 218, in api_read
    count, lst = self.datamodel.query(joined_filters, order_column, order_direction, page=page, page_size=page_size)
  File "/home/centos/supersets/venv/lib/python2.7/site-packages/flask_appbuilder/models/sqla/interface.py", line 111, in query
    count = query_count.scalar()
  File "/home/centos/supersets/venv/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 2843, in scalar
    ret = self.one()
  File "/home/centos/supersets/venv/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 2814, in one
    ret = self.one_or_none()
  File "/home/centos/supersets/venv/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 2784, in one_or_none
    ret = list(self)
  File "/home/centos/supersets/venv/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 2855, in __iter__
    return self._execute_and_instances(context)
  File "/home/centos/supersets/venv/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 2878, in _execute_and_instances
    result = conn.execute(querycontext.statement, self._params)
  File "/home/centos/supersets/venv/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 945, in execute
    return meth(self, multiparams, params)
  File "/home/centos/supersets/venv/lib/python2.7/site-packages/sqlalchemy/sql/elements.py", line 263, in _execute_on_connection
    return connection._execute_clauseelement(self, multiparams, params)
  File "/home/centos/supersets/venv/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1053, in _execute_clauseelement
    compiled_sql, distilled_params
  File "/home/centos/supersets/venv/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1189, in _execute_context
    context)
  File "/home/centos/supersets/venv/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1402, in _handle_dbapi_exception
    exc_info
  File "/home/centos/supersets/venv/lib/python2.7/site-packages/sqlalchemy/util/compat.py", line 203, in raise_from_cause
    reraise(type(exception), exception, tb=exc_tb, cause=cause)
  File "/home/centos/supersets/venv/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1182, in _execute_context
    context)
  File "/home/centos/supersets/venv/lib/python2.7/site-packages/sqlalchemy/engine/default.py", line 470, in do_execute
    cursor.execute(statement, parameters)
OperationalError: (sqlite3.OperationalError) no such table: dashboards [SQL: u'SELECT count(?) AS count_1 \nFROM dashboards'] [parameters: ('*',)]

Steps to reproduce

Fresh install on Centos: CentOS Linux release 7.4.1708
Python version 2.7.5
Follow steps in:
(Including the Load some data step)
Set the db connection to a local sqlite3 db.
In superset_config.py SQLALCHEMY_DATABASE_URI = 'sqlite:////home/centos/superset/superset_meta.db '

Additionally the upgrade steps after the Load some Data step do not change the error.

@xrmx
Copy link
Contributor

xrmx commented Sep 27, 2017

Are you sure you are using that config file?

@wfowlks
Copy link
Author

wfowlks commented Sep 27, 2017

Do you mean superset_config.py?
It is in the directory and I checked that it is in PYTHONPATH
I also checked that the file exists. Also doing an ls in the directory that I am running from shows only: superset_meta.db
and doing: find / -name "*.db" returns:

/home/centos/superset/superset_meta.db
/home/centos/.superset/superset.db

is there a reason that running with or without the -d would pick one over the other?

@xrmx
Copy link
Contributor

xrmx commented Sep 27, 2017

I don't think it's -d, i think it's the PYTHONPATH, please make the dir where the superset_config.py is explicitly the first.

@wfowlks
Copy link
Author

wfowlks commented Sep 28, 2017

So I exported to PYTHONPATH the directory, using export before calling the command and setting it for the subshell command, and they both yielded the same result (error).

I then changed the default port to 8081 to make sure that it was using the correct superset_config.py

Once I did that I realized the superset runserver -d was not picking up the port change, so is that running using the /home/centos/.superset/superset.db ?

I then set the environment variable from the bash script, and then refreshed the shell. Then I went through the DB update steps and it worked.

The issue was that when I was running the other superset commands the PYTHONPATH did not have the working directory as the first directory. After setting it to be the first, I then did:

superset db upgrade
superset init
superset runserver

and it worked.

Thank you so much for all your help!

@wfowlks wfowlks closed this as completed Sep 28, 2017
@Exentriq
Copy link

Hi @wfowlks

can you try to explain how did you fix this issue?
I used this how-to to install superset:
https://superset.incubator.apache.org/installation.html#getting-started

after the login we see an error page like your:

sqlalchemy.exc.OperationalError
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) no such table: user_attribute
[SQL: SELECT user_attribute.welcome_dashboard_id AS user_attribute_welcome_dashboard_id
FROM user_attribute
WHERE user_attribute.user_id = ?]
[parameters: ('1',)]
(Background on this error at: http://sqlalche.me/e/e3q8)

@wfowlks
Copy link
Author

wfowlks commented Apr 23, 2019

If this is in linux, you will need to identify the working path you want to use and you will do:
export PYTHONPATH=/your/working/path:$PYTHONPATH
I added that line to the bash scripts that were running. It's been a while and I no longer have access to those files but I believe I modified the actual upgrade, init and runserver scripts where superset was running from.

@Exentriq
Copy link

Damn, solved with this command:
pip install sqlalchemy==1.2.18

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants