rubypollev commented on issue #8183: How to pass time filters to SQL Lab queries
URL: 
https://github.com/apache/incubator-superset/issues/8183#issuecomment-529045245
 
 
   @cachafla I've written a Jinja addon with the `get_since_until` utility 
function to do just this. If there's interest in this I'd be happy to make a 
PR. 
   
   **Usage**
   
   A query on a dashboard with my addon directly preceding the time field:
   ```
   SELECT *
   FROM table
   WHERE changed_on {{ time_filter() }}
   ``` 
   
   With this dashboard filter set: 
   ![Screen Shot 2019-09-06 at 4 24 43 
PM](https://user-images.githubusercontent.com/45610410/64465682-e3777380-d0c2-11e9-9fd1-beca221f031b.png)
   
   Results in SQL like this:
   
   ```
   SELECT *
   FROM table
   WHERE changed_on BETWEEN "2018-09-06T00:00:00" AND "2019-09-06T00:00:00"
   ``` 
   

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to