zhaoyongjie edited a comment on issue #15613:
URL: https://github.com/apache/superset/issues/15613#issuecomment-877742092


   we can make macros in the `config.py`, for instance:
   
   ```
   from datetime import datetime
   
   def current_datetime():
       return datetime.now().strftime("%Y-%m-%d")
   
   JINJA_CONTEXT_ADDONS = {
       "current_datetime": current_datetime
   }
   ```
   
   ensure that the flag `ENABLE_TEMPLATE_PROCESSING` is enabled
   ```
   FEATURE_FLAGS = {
       ...
       "ENABLE_TEMPLATE_PROCESSING": True,
   }
   ```
   
   Then use in SQLLab
   
   ```
   select ...
   from ...
   where start > {{ current_datetime() }}
   ```


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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



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

Reply via email to