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

   ### Bug description
   
   I have cleared the database and init superset with roles and permissions and 
did not load the sample data as I wanted to start fresh.
   When I clicked SQL Lab, I got the error` "Unable to add a new tab to the 
backend. Please contact your administrator."`.
   
   And I looked at the network tab the API for `api/v1/tabstateview/` was 
throwing 500 due to `'dbId'` is not found.
   
   ```
   addQueryEditor({
           dbId: dbId || defaultDbId || firstDbId,
           schema: schema ?? null,
           autorun: autorun ?? false,
           sql: `${warning}SELECT ...`,
           queryLimit: queryLimit || common.conf.DEFAULT_SQLLAB_LIMIT,
           name,
   }),
   ```
   
   When I changed the code as below I was able to create a tab in SQL Lab.
   
   ```
   addQueryEditor({
           dbId: (dbId || defaultDbId || firstDbId) ?? null,
           schema: schema ?? null,
           autorun: autorun ?? false,
           sql: `${warning}SELECT ...`,
           queryLimit: queryLimit || common.conf.DEFAULT_SQLLAB_LIMIT,
           name,
   }),
   ```
   What is the right approach? 
   
   1. Show the `DatabaseModal` if no database ids are found?
   2. Display the new tab with no database in the right Panel?
   
   
   ### How to reproduce the bug
   
   1. Init Superset with no example data.
   2. Click on SQL Lab
   
   ### Screenshots/recordings
   
   _No response_
   
   ### Superset version
   
   master / latest-dev
   
   ### Python version
   
   3.11
   
   ### Node version
   
   16
   
   ### Browser
   
   Chrome
   
   ### Additional context
   
   _No response_
   
   ### Checklist
   
   - [ ] I have searched Superset docs and Slack and didn't find a solution to 
my problem.
   - [ ] I have searched the GitHub issue tracker and didn't find a similar bug 
report.
   - [ ] I have checked Superset's logs for errors and if I found a relevant 
Python stacktrace, I included it here as text in the "additional context" 
section.


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