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

[GitHub] [superset] TIMFANGZI opened a new issue, #23807: It shows Key (database_id)=(7) is not present in table "dbs" after trying to add a tab in SQL Editor

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

   I installed Superset with Helm in Kubernetes, and I also changed the config to let superset integrate Okta. However, after integrating the Okta, the new user can login but can not use SQL editor with the following error:
   
   `[SQL: INSERT INTO tab_state (created_on, changed_on, extra_json, user_id, label, active, database_id, schema, sql, query_limit, latest_query_id, autorun, template_params, hide_left_bar, saved_query_id, created_by_fk, changed_by_fk) VALUES (%(created_on)s, %(changed_on)s, %(extra_json)s, %(user_id)s, %(label)s, %(active)s, %(database_id)s, %(schema)s, %(sql)s, %(query_limit)s, %(latest_query_id)s, %(autorun)s, %(template_params)s, %(hide_left_bar)s, %(saved_query_id)s, %(created_by_fk)s, %(changed_by_fk)s) RETURNING tab_state.id]
   [parameters: {'created_on': datetime.datetime(2023, 4, 25, 7, 4, 29, 464360), 'changed_on': datetime.datetime(2023, 4, 25, 7, 4, 29, 464366), 'extra_json': '{}', 'user_id': '6', 'label': 'Untitled Query 3', 'active': True, 'database_id': 7, 'schema': 'information_schema', 'sql': 'SELECT ...', 'query_limit': 1000, 'latest_query_id': None, 'autorun': False, 'template_params': None, 'hide_left_bar': False, 'saved_query_id': None, 'created_by_fk': 6, 'changed_by_fk': 6}]
   (Background on this error at: http://sqlalche.me/e/13/gkpj)
   [ERROR  ] 04/25/2023 07:04:29    base.py:471 : (psycopg2.errors.ForeignKeyViolation) insert or update on table "tab_state" violates foreign key constraint "tab_state_database_id_fkey"
   DETAIL:  Key (database_id)=(7) is not present in table "dbs".
   
   [SQL: INSERT INTO tab_state (created_on, changed_on, extra_json, user_id, label, active, database_id, schema, sql, query_limit, latest_query_id, autorun, template_params, hide_left_bar, saved_query_id, created_by_fk, changed_by_fk) VALUES (%(created_on)s, %(changed_on)s, %(extra_json)s, %(user_id)s, %(label)s, %(active)s, %(database_id)s, %(schema)s, %(sql)s, %(query_limit)s, %(latest_query_id)s, %(autorun)s, %(template_params)s, %(hide_left_bar)s, %(saved_query_id)s, %(created_by_fk)s, %(changed_by_fk)s) RETURNING tab_state.id]
   `
   However, in the metadata from PostgreSQL, there is not database id == 7. And the user created **before integration** with Okta can do this operation without error.
   
   #### How to reproduce the bug
   
   1. Go to SQL editor
   2. Click on add a new tab
   3. See error
   
   ### Expected results
   
   what you expected to happen.
   
   ### Actual results
   
   what actually happens.
   
   #### Screenshots
   
   If applicable, add screenshots to help explain your problem.
   
   
   ### Environment
   
   (please complete the following information):
   
   - browser type and version:
   - superset version: 2.0.0
   - python version: 3.8
   - node.js version: `node -v`
   - any feature flags active:
   
   ### 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
   
   Add any other context about the problem here.
   


-- 
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] TIMFANGZI commented on issue #23807: It shows Key (database_id)=(7) is not present in table "dbs" after trying to add a tab in SQL Editor

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

   > I too am facing the same issue for user who is not admin but has role alpha. Haven't tried with other roles though.
   
   are you also use oauth to login?


-- 
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] TIMFANGZI commented on issue #23807: It shows Key (database_id)=(7) is not present in table "dbs" after trying to add a tab in SQL Editor

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

   <img width="1274" alt="image" src="https://user-images.githubusercontent.com/46588930/234208132-1e0afa62-132b-436a-828c-3c6e840fda42.png">
   


-- 
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] divick commented on issue #23807: It shows Key (database_id)=(7) is not present in table "dbs" after trying to add a tab in SQL Editor

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

   I too am facing the same issue.


-- 
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] TIMFANGZI commented on issue #23807: It shows Key (database_id)=(7) is not present in table "dbs" after trying to add a tab in SQL Editor

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

   I registered a few users when AUTH_TYPE = AUTH_DB, and then I switched to AUTH_TYPE = AUTH_OAUTH, each user can login and use sql edit. However, the user I created after AUTH_TYPE = AUTH_OAUTH, they can login but can not use sql editor and in superset logs, I find the error mentioned above.


-- 
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] TIMFANGZI closed issue #23807: It shows Key (database_id)=(7) is not present in table "dbs" after trying to add a tab in SQL Editor

Posted by "TIMFANGZI (via GitHub)" <gi...@apache.org>.
TIMFANGZI closed issue #23807: It shows Key (database_id)=(7) is not present in table "dbs" after trying to add a tab in SQL Editor
URL: https://github.com/apache/superset/issues/23807


-- 
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] TIMFANGZI commented on issue #23807: It shows Key (database_id)=(7) is not present in table "dbs" after trying to add a tab in SQL Editor

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

   when I change from Chrome to Safari, it is fixed, maybe the problem of cache...


-- 
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