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/03/18 22:51:32 UTC

[GitHub] [incubator-superset] betodealmeida opened a new pull request #7052: Allow LIMIT to be specified in parameters

betodealmeida opened a new pull request #7052: Allow LIMIT to be specified in parameters
URL: https://github.com/apache/incubator-superset/pull/7052
 
 
   Currently the query limit is extracted from the SQL **before** it's processed with the template parameters. If we have the following query in SQL Lab:
   
   ```sql
   SELECT * FROM logs LIMIT {{ limit }}
   ```
   
   And we set the parameters to `{"limit": 5}`, what happens is:
   
   1. Superset tries to extract a LIMIT from the query before any parameters are applied ("raw").
   2. Since it can't it extract the query limit it uses the limit from the UI (default 1000).
   3. It builds a query **object** with the raw query, with limit 1000.
   4. It translates the query to `SELECT * FROM logs LIMIT 5`.
   5. It dispatches the translated query and the query object.
   6. it sees that the query object has a limit of 1000.
   7. It replaces `LIMIT 5` with `LIMIT 1000`.
   
   This PR changes the flow so that the limits are extracted after the template processing.
   

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