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

Make select_star work with SQL Lab views #8598

Merged
merged 2 commits into from Nov 20, 2019
Merged

Make select_star work with SQL Lab views #8598

merged 2 commits into from Nov 20, 2019

Conversation

betodealmeida
Copy link
Member

@betodealmeida betodealmeida commented Nov 19, 2019

CATEGORY

Choose one

  • Bug Fix
  • Enhancement (new features, refinement)
  • Refactor
  • Add tests
  • Build / Development Environment
  • Documentation

SUMMARY

Currently, when we call select_star for a SQL Lab view the generated SQL is incorrect. Eg, if we have the following query in SQL Lab:

SELECT * FROM ab_permission_view_role

When we go to Explore view and click "Explore in SQL Lab" in the datasource dropdown we'll get something like:

SELECT *
FROM superset.`Beto Dealmeida-Untitled Query 2-_HgL-mU8p`
LIMIT 100

The query fails because there's no table called Beto Dealmeida-Untitled Query 2-_HgL-mU8p.

I fixed select_star so that when the datasource has the sql attribute it's used as the source of the FROM, instead of the table name. This produces:

SELECT *
FROM
  (SELECT *
   FROM ab_permission_view_role) AS `Untitled Query 2-_HgL-mU8p`
LIMIT 100

TEST PLAN

I'm currently adding and fixing unit tests.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Changes UI
  • Requires DB Migration.
  • Confirm DB Migration upgrade and downgrade tested.
  • Introduces new feature or API
  • Removes existing feature or API

REVIEWERS

@graceguo-supercat @etr2460

@betodealmeida betodealmeida merged commit 964e6db into master Nov 20, 2019
graceguo-supercat pushed a commit to airbnb/superset-fork that referenced this pull request Dec 10, 2019
soboko pushed a commit to airbnb/superset-fork that referenced this pull request Dec 12, 2019
etr2460 pushed a commit that referenced this pull request Jan 6, 2020
graceguo-supercat pushed a commit to graceguo-supercat/superset that referenced this pull request Jan 6, 2020
graceguo-supercat pushed a commit that referenced this pull request Jan 6, 2020
@amitmiran137 amitmiran137 deleted the VIZ-1194 branch March 29, 2021 18:09
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.36.0 labels Feb 28, 2024
cccs-rc pushed a commit to CybercentreCanada/superset that referenced this pull request Mar 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels size/M 🚢 0.36.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants