Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Superset init without example data, throws code 500 in sqltab page due to no database found #27633

Closed
2 of 3 tasks
sebint opened this issue Mar 25, 2024 · 3 comments
Closed
2 of 3 tasks

Comments

@sebint
Copy link

sebint commented Mar 25, 2024

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? So that User can create the database first, and then proceeds to SQL Lab.
  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.
@str8edgedave
Copy link

I have just completed a clean installation of Superset 4.0.2 on Fedora 40, using Postgres as the Metadata database and I am seeing this issue as well.

When I added in the example data and then deleted it, the problem went away.

@rusackas
Copy link
Member

I can't help but wonder if this is related to:
#29694

@michael-s-molina
Copy link
Member

Fixed by #29993.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants