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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to