You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2019/11/19 01:39:51 UTC

[GitHub] [incubator-superset] betodealmeida opened a new pull request #8598: Make select_star work with SQL Lab views

betodealmeida opened a new pull request #8598: Make select_star work with SQL Lab views
URL: https://github.com/apache/incubator-superset/pull/8598
 
 
   ### CATEGORY
   
   Choose one
   
   - [X] Bug Fix
   - [ ] Enhancement (new features, refinement)
   - [ ] Refactor
   - [ ] Add tests
   - [ ] Build / Development Environment
   - [ ] Documentation
   
   ### SUMMARY
   <!--- Describe the change below, including rationale and design decisions -->
   
   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:
   
   ```sql
   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:
   
   ```sql
   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:
   
   ```sql
   SELECT *
   FROM
     (SELECT *
      FROM ab_permission_view_role) AS `Untitled Query 2-_HgL-mU8p`
   LIMIT 100
   ```
   
   <!-- ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF -->
   <!--- Skip this if not applicable -->
   
   ### TEST PLAN
   <!--- What steps should be taken to verify the changes -->
   
   I'm currently adding and fixing unit tests.
   
   ### ADDITIONAL INFORMATION
   <!--- Check any relevant boxes with "x" -->
   <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
   - [ ] 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
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org