Incubator-superset: sqlalchemy.exc.ProgrammingError when installing via docker-compose up on Windows as of Commit 3e374dab0

Created on 28 Aug 2020  路  8Comments  路  Source: apache/incubator-superset

A clear and concise description of what the bug is.

Expected results

docker-compose up as per instructions.
Open http://localhost:8088/ and see home page of Superset.

Actual results

sqlalchemy.exc.ProgrammingError.
Reading the logs it looks like one of the dbs or tables hasn't fully initialised.

Screenshots

If applicable, add screenshots to help explain your problem.

Traceback:

sqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation "ab_permission_view_role" does not exist
LINE 2: FROM ab_permission_view JOIN ab_permission_view_role ON ab_p...
                                     ^

[SQL: SELECT ab_permission_view.id AS ab_permission_view_id, ab_permission_view.permission_id AS ab_permission_view_permission_id, ab_permission_view.view_menu_id AS ab_permission_view_view_menu_id 
FROM ab_permission_view JOIN ab_permission_view_role ON ab_permission_view.id = ab_permission_view_role.permission_view_id JOIN ab_role ON ab_role.id = ab_permission_view_role.role_id JOIN ab_permission ON ab_permission.id = ab_permission_view.permission_id JOIN ab_view_menu ON ab_view_menu.id = ab_permission_view.view_menu_id 
WHERE ab_permission.name = %(name_1)s AND ab_role.id IN (%(id_1)s)]
[parameters: {'name_1': 'menu_access', 'id_1': 2}]
(Background on this error at: http://sqlalche.me/e/13/f405)

Traceback (most recent call last)
File "/usr/local/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1278, in _execute_context
cursor, statement, parameters, context
File "/usr/local/lib/python3.6/site-packages/sqlalchemy/engine/default.py", line 593, in do_execute
cursor.execute(statement, parameters)
The above exception was the direct cause of the following exception:
File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 2464, in __call__
return self.wsgi_app(environ, start_response)
File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 2450, in wsgi_app
response = self.handle_exception(e)
File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1867, in handle_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python3.6/site-packages/flask/_compat.py", line 39, in reraise
raise value
File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 2447, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1952, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1821, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python3.6/site-packages/flask/_compat.py", line 39, in reraise
raise value
File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1950, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1936, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/usr/local/lib/python3.6/site-packages/flask_appbuilder/security/views.py", line 501, in login
self.login_template, title=self.title, form=form, appbuilder=self.appbuilder
File "/usr/local/lib/python3.6/site-packages/flask_appbuilder/baseviews.py", line 281, in render_template
template, **dict(list(kwargs.items()) + list(self.extra_args.items()))
File "/usr/local/lib/python3.6/site-packages/flask/templating.py", line 140, in render_template
ctx.app,
File "/usr/local/lib/python3.6/site-packages/flask/templating.py", line 120, in _render
rv = template.render(context)
File "/usr/local/lib/python3.6/site-packages/jinja2/environment.py", line 1090, in render
self.environment.handle_exception()
File "/usr/local/lib/python3.6/site-packages/jinja2/environment.py", line 832, in handle_exception
reraise(*rewrite_traceback_stack(source=source))
File "/usr/local/lib/python3.6/site-packages/jinja2/_compat.py", line 28, in reraise
raise value.with_traceback(tb)
File "/usr/local/lib/python3.6/site-packages/flask_appbuilder/templates/appbuilder/general/security/login_db.html", line 2, in top-level template code
{% extends "appbuilder/base.html" %}
File "/usr/local/lib/python3.6/site-packages/flask_appbuilder/templates/appbuilder/base.html", line 1, in top-level template code
{% extends base_template %}
File "/app/superset/templates/superset/base.html", line 20, in top-level template code
{% from 'superset/partials/asset_bundle.html' import css_bundle, js_bundle with context %}
File "/app/superset/templates/appbuilder/baselayout.html", line 20, in top-level template code
{% import 'appbuilder/baselib.html' as baselib %}
File "/usr/local/lib/python3.6/site-packages/flask_appbuilder/templates/appbuilder/init.html", line 46, in top-level template code
{% block body %}
File "/app/superset/templates/appbuilder/baselayout.html", line 45, in block "body"
<div id="app" data-bootstrap="{{ bootstrap_data() }}"></div>
File "/app/superset/views/base.py", line 326, in serialize_bootstrap_data
{"common": common_bootstrap_payload()},
File "/app/superset/views/base.py", line 318, in common_bootstrap_payload
"menu_data": menu_data(),
File "/app/superset/views/base.py", line 259, in menu_data
menu = appbuilder.menu.get_data()
File "/usr/local/lib/python3.6/site-packages/flask_appbuilder/menu.py", line 64, in get_data
self.get_flat_name_list()
File "/usr/local/lib/python3.6/site-packages/flask_appbuilder/security/manager.py", line 1169, in get_user_menu_access
None, "menu_access", view_menus_name=menu_names
File "/usr/local/lib/python3.6/site-packages/flask_appbuilder/security/manager.py", line 1141, in _get_user_permission_view_menus
permission_name, db_role_ids
File "/usr/local/lib/python3.6/site-packages/flask_appbuilder/security/sqla/manager.py", line 362, in find_roles_permission_view_menus
self.role_model.id.in_(role_ids),
File "/usr/local/lib/python3.6/site-packages/sqlalchemy/orm/query.py", line 3341, in all
return list(self)
File "/usr/local/lib/python3.6/site-packages/sqlalchemy/orm/query.py", line 3503, in __iter__
return self._execute_and_instances(context)
File "/usr/local/lib/python3.6/site-packages/sqlalchemy/orm/query.py", line 3528, in _execute_and_instances
result = conn.execute(querycontext.statement, self._params)
File "/usr/local/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1014, in execute
return meth(self, multiparams, params)
File "/usr/local/lib/python3.6/site-packages/sqlalchemy/sql/elements.py", line 298, in _execute_on_connection
return connection._execute_clauseelement(self, multiparams, params)
File "/usr/local/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1133, in _execute_clauseelement
distilled_params,
File "/usr/local/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1318, in _execute_context
e, statement, parameters, cursor, context
File "/usr/local/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1512, in _handle_dbapi_exception
sqlalchemy_exception, with_traceback=exc_info[2], from_=e
File "/usr/local/lib/python3.6/site-packages/sqlalchemy/util/compat.py", line 178, in raise_
raise exception
File "/usr/local/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1278, in _execute_context
cursor, statement, parameters, context
File "/usr/local/lib/python3.6/site-packages/sqlalchemy/engine/default.py", line 593, in do_execute
cursor.execute(statement, parameters)
sqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation "ab_permission_view_role" does not exist
LINE 2: FROM ab_permission_view JOIN ab_permission_view_role ON ab_p...
^

[SQL: SELECT ab_permission_view.id AS ab_permission_view_id, ab_permission_view.permission_id AS ab_permission_view_permission_id, ab_permission_view.view_menu_id AS ab_permission_view_view_menu_id
FROM ab_permission_view JOIN ab_permission_view_role ON ab_permission_view.id = ab_permission_view_role.permission_view_id JOIN ab_role ON ab_role.id = ab_permission_view_role.role_id JOIN ab_permission ON ab_permission.id = ab_permission_view.permission_id JOIN ab_view_menu ON ab_view_menu.id = ab_permission_view.view_menu_id
WHERE ab_permission.name = %(name_1)s AND ab_role.id IN (%(id_1)s)]
[parameters: {'name_1': 'menu_access', 'id_1': 2}]
(Background on this error at: http://sqlalche.me/e/13/f405)
The debugger caught an exception in your WSGI application. You can now look at the traceback which led to the error.
To switch between the interactive traceback and the plaintext one, you can click on the "Traceback" headline. From the text traceback you can also create a paste of it. For code execution mouse-over the frame you want to debug and click on the console icon on the right side.

You can execute arbitrary Python code in the stack frames and there are some extra helpers available for introspection:

dump() shows all variables in the frame
dump(obj) dumps all that's known about the object

How to reproduce the bug

  1. git pull
  2. git checkout 3e374dab0 or git checkout master
  3. docker-compose up
  4. Open http://localhost:8088/

Environment

Docker as per instructions.

  • superset version: superset version - 3e374dab0 - commit
  • python version: python --version
  • node.js version: node -v
  • npm version: npm -v

Checklist

Make sure these boxes are checked before submitting your issue - thank you!

  • [x ] I have checked the superset logs for python stacktraces and included it here as text if there are any.
  • [x] I have reproduced the issue with at least the latest released version of superset.
  • [x ] I have checked the issue tracker for the same issue and I haven't found one similar.
  • There is one also about docker install. , but on an ubuntu environment with a different error.

Additional context

Windows 10 running WSL as a backend.

If merged this PR perhaps means it's not a valid bug as windows: https://github.com/apache/incubator-superset/pull/10511

#bug

Most helpful comment

Issue-Label Bot is automatically applying the label #bug to this issue, with a confidence of 0.75. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

All 8 comments

Issue-Label Bot is automatically applying the label #bug to this issue, with a confidence of 0.75. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

I can confirm the same error on Mac (OS Catalina - 10.15.6 (19G2021))

Just a shot in the dark:

have you run init?

Either use the Docker init container, or run the superset command line
superset init

I ran into (unrelated) issues because I had disabled the init container

Either use the Docker init container, or run the superset command line
superset init

How do you run init? Are the commands documented?

I am also getting the missing table error when following the Installing Superset Locally Using Docker Compose instructions.

sqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation "ab_permission_view_role" does not exist
LINE 2: FROM ab_permission_view JOIN ab_permission_view_role ON ab_p...
^

[SQL: SELECT ab_permission_view.id AS ab_permission_view_id, ab_permission_view.permission_id AS ab_permission_view_permission_id, ab_permission_view.view_menu_id AS ab_permission_view_view_menu_id
FROM ab_permission_view JOIN ab_permission_view_role ON ab_permission_view.id = ab_permission_view_role.permission_view_id JOIN ab_role ON ab_role.id = ab_permission_view_role.role_id JOIN ab_permission ON ab_permission.id = ab_permission_view.permission_id JOIN ab_view_menu ON ab_view_menu.id = ab_permission_view.view_menu_id
WHERE ab_permission.name = %(name_1)s AND ab_role.id IN (%(id_1)s)]

From what I can see on the master branch, there isn't a DB migration to create the ab_permission table. There are only a couple of test files that reference the table.

https://github.com/apache/incubator-superset/search?q=ab_permission

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. For admin, please label this issue .pinned to prevent stale bot from closing the issue.

Ping

Was this page helpful?
0 / 5 - 0 ratings

Related issues

john-bodley picture john-bodley  路  3Comments

kalimuthu123 picture kalimuthu123  路  3Comments

lenguyenthedat picture lenguyenthedat  路  3Comments

sashank picture sashank  路  3Comments

ghost picture ghost  路  3Comments