You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "kritik (via GitHub)" <gi...@apache.org> on 2023/04/12 12:41:33 UTC

[GitHub] [superset] kritik opened a new issue, #23659: Superset cannot execute query

kritik opened a new issue, #23659:
URL: https://github.com/apache/superset/issues/23659

   A clear and concise description of what the bug is.
   I upgraded superset from the old version and ran superset db upgrade. After logining in I opened SQL lab and run  the query. I get an error. Logs say 
   ```
   127.0.0.1 - - [12/Apr/2023:12:32:55 +0000] "GET /api/v1/me/ HTTP/1.1" 200 240 "https://visual.verticalchange.com/superset/sqllab/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:109.0) Gecko/20100101 Firefox/111.0"
   
   127.0.0.1 - - [12/Apr/2023:12:33:00 +0000] "GET /api/v1/me/ HTTP/1.1" 200 240 "https://visual.verticalchange.com/superset/sqllab/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:109.0) Gecko/20100101 Firefox/111.0"
   
   2023-04-12 12:33:01,381:ERROR:superset.views.base:(psycopg2.errors.ForeignKeyViolation) insert or update on table "tab_state" violates foreign key constraint "tab_state_latest_query_id_fkey"
   
   DETAIL:  Key (latest_query_id)=(3H09xIwGw) is not present in table "query".
   
   [SQL: UPDATE tab_state SET changed_on=%(changed_on)s, latest_query_id=%(latest_query_id)s, changed_by_fk=%(changed_by_fk)s WHERE tab_state.id = %(id_1)s]
   
   [parameters: {'changed_on': datetime.datetime(2023, 4, 12, 12, 33, 1, 379976), 'latest_query_id': '3H09xIwGw', 'changed_by_fk': 226, 'id_1': 4}]
   
   (Background on this error at: https://sqlalche.me/e/14/gkpj)
   
   Traceback (most recent call last):
   
     File "/usr/local/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1819, in _execute_context
   
       self.dialect.do_execute(
   
     File "/usr/local/lib/python3.8/site-packages/sqlalchemy/engine/default.py", line 732, in do_execute
   
       cursor.execute(statement, parameters)
   
   psycopg2.errors.ForeignKeyViolation: insert or update on table "tab_state" violates foreign key constraint "tab_state_latest_query_id_fkey"
   
   DETAIL:  Key (latest_query_id)=(3H09xIwGw) is not present in table "query".
   
   The above exception was the direct cause of the following exception:
   
   Traceback (most recent call last):
   
     File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1517, in full_dispatch_request
   
       rv = self.dispatch_request()
   
     File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1503, in dispatch_request
   
       return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
   
     File "/usr/local/lib/python3.8/site-packages/flask_appbuilder/security/decorators.py", line 181, in wraps
   
       return f(self, *args, **kwargs)
   
     File "/app/superset/views/sql_lab/views.py", line 227, in put
   
       db.session.query(TabState).filter_by(id=tab_state_id).update(fields)
   
     File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/query.py", line 3294, in update
   
       result = self.session.execute(
   
     File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 1696, in execute
   
       result = conn._execute_20(statement, params or {}, execution_options)
   
     File "/usr/local/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1631, in _execute_20
   
       return meth(self, args_10style, kwargs_10style, execution_options)
   
     File "/usr/local/lib/python3.8/site-packages/sqlalchemy/sql/elements.py", line 325, in _execute_on_connection
   
       return connection._execute_clauseelement(
   
     File "/usr/local/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1498, in _execute_clauseelement
   
       ret = self._execute_context(
   
     File "/usr/local/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1862, in _execute_context
   
       self._handle_dbapi_exception(
   
     File "/usr/local/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 2043, in _handle_dbapi_exception
   
       util.raise_(
   
     File "/usr/local/lib/python3.8/site-packages/sqlalchemy/util/compat.py", line 207, in raise_
   
       raise exception
   
     File "/usr/local/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1819, in _execute_context
   
       self.dialect.do_execute(
   
     File "/usr/local/lib/python3.8/site-packages/sqlalchemy/engine/default.py", line 732, in do_execute
   
       cursor.execute(statement, parameters)
   
   sqlalchemy.exc.IntegrityError: (psycopg2.errors.ForeignKeyViolation) insert or update on table "tab_state" violates foreign key constraint "tab_state_latest_query_id_fkey"
   
   DETAIL:  Key (latest_query_id)=(3H09xIwGw) is not present in table "query".
   
   [SQL: UPDATE tab_state SET changed_on=%(changed_on)s, latest_query_id=%(latest_query_id)s, changed_by_fk=%(changed_by_fk)s WHERE tab_state.id = %(id_1)s]
   
   [parameters: {'changed_on': datetime.datetime(2023, 4, 12, 12, 33, 1, 379976), 'latest_query_id': '3H09xIwGw', 'changed_by_fk': 226, 'id_1': 4}]
   
   (Background on this error at: https://sqlalche.me/e/14/gkpj)
   
   127.0.0.1 - - [12/Apr/2023:12:33:01 +0000] "PUT /tabstateview/4 HTTP/1.1" 500 787 "https://visual.verticalchange.com/superset/sqllab/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:109.0) Gecko/20100101 Firefox/111.0"
   ```
   
   When I opened DB and checked query table. No new records are there
   
   #### How to reproduce the bug
   
   I don't know as totally the same code is running on edge system
   
   ### Expected results
   
   SQL should be running
   
   ### Actual results
   
   Database error: Forbidden
   
   ### Environment
   
   (please complete the following information):
   
   - browser type and version: FF
   - superset version: 0.4.0, git commit 37766b9527979215effc46d351453b6a9b644bd2
   - python version: 3.8.16
   - node.js version: --
   - any feature flags active:
   FEATURE_FLAGS = {
       # Enables Alerts and reports new implementation
       "ALERT_REPORTS": True,
       "DASHBOARD_CROSS_FILTERS": True,
       "DASHBOARD_RBAC": True,
       "ENABLE_TEMPLATE_PROCESSING": True,
       # When True, this escapes HTML (rather than rendering it) in Markdown components
       "ESCAPE_MARKDOWN_HTML": True,
       "ESTIMATE_QUERY_COST": True,
       "LISTVIEWS_DEFAULT_CARD_VIEW": True,
       "SQLLAB_BACKEND_PERSISTENCE": True,
       # Exposes API endpoint to compute thumbnails
       "THUMBNAILS": True,
       "THUMBNAILS_SQLA_LISTENERS": True,
       "EMBEDDED_SUPERSET": True,
   }
   
   ### Checklist
   
   Make sure to follow these steps before submitting your issue - thank you!
   
   - [ ] I have checked the superset logs for python stacktraces and included it here as text if there are 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.
   
   ### Additional context
   
   running on docker. Is it possible that I missed some migration instraction?
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] ruotianwang commented on issue #23659: Superset cannot execute query

Posted by "ruotianwang (via GitHub)" <gi...@apache.org>.
ruotianwang commented on issue #23659:
URL: https://github.com/apache/superset/issues/23659#issuecomment-1533864627

   @kritik 
   
   Hello Vladimir, our team met exactly the same issue yesterday and today. Both of times issue are self-recovered like 30mins. Did you see the same issue happening again?
   
   Superset version we are using:
   ```
   image:
     repository: apache/superset
     tag: 2.0.1
     pullPolicy: IfNotPresent
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] kritik commented on issue #23659: Superset cannot execute query

Posted by "kritik (via GitHub)" <gi...@apache.org>.
kritik commented on issue #23659:
URL: https://github.com/apache/superset/issues/23659#issuecomment-1505457798

   I did smth and cannot reproduce. Closing


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] kritik closed issue #23659: Superset cannot execute query

Posted by "kritik (via GitHub)" <gi...@apache.org>.
kritik closed issue #23659: Superset cannot execute query
URL: https://github.com/apache/superset/issues/23659


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] bogdanstate commented on issue #23659: Superset cannot execute query

Posted by "bogdanstate (via GitHub)" <gi...@apache.org>.
bogdanstate commented on issue #23659:
URL: https://github.com/apache/superset/issues/23659#issuecomment-1589070070

   I am running into the same issue w/ Superset 2.0.1rc4. I am able to reproduce the problem *only* by running the following Trino query:
   
   ```
   FROM (SELECT 1)
   SELECT 1
   ```
   
   If I change the order of the FROM / SELECT or use no parentheses the bug goes away. The problem is that no SQL containing subqueries seems to run (at least in Trino).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] kritik commented on issue #23659: Superset cannot execute query

Posted by "kritik (via GitHub)" <gi...@apache.org>.
kritik commented on issue #23659:
URL: https://github.com/apache/superset/issues/23659#issuecomment-1534112630

   @ruotianwang actually I found the issue. I didn't run `superset init`.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org