Who Repairs Dashboards In Atlanta
Interactive Dashboards in Apache Superset
What if you want to make your dashboard more interactive? What if you take a complex SQL query for your dataset and y'all have to implement an algorithm that will depend on filters y'all set in the dashboard or fifty-fifty based on parameters from a link for that particular dashboard? The answer to all of the questions is Jinja templates.
                          
Get-go of all, you demand to activate Jinja templating if you lot have not done this before. To do this, you should add another element to the FEATURE_FLAGS dictionary in your superset_config.py. Chemical element's primal will be ENABLE_TEMPLATE_PROCESSING, and the value will exist True. Here is how it will look like:
          FEATURE_FLAGS = {
            ...  # your existing flags
            "ENABLE_TEMPLATE_PROCESSING": True,
}                After calculation the parameter you lot should rebuild your Docker epitome if you utilize Superset in a container. Here are two of my articles that could aid you Run Apache Superset Locally in 10 Minutes and change settings via superset_config.py.
At present, it'due south time to use Jinja macros in our SQL query! You may start with          from_dttm          or          to_dttm          standard Superset macros, for example. If you become to edit your virtual dataset, y'all may use          {{to_dttm}}          placeholder for the Jinja processor. Jinja volition supplant that placeholder with the finish bound of the time range filter you ready. Let's commencement with an example query for MariaDB:
          SELECT DATE_SUB(At present(), INTERVAL 1 DAY) As XDATE                We will utilize it to create a new virtual dataset in our system by clicking EXPLORE button and salve. And so, we will save a table nautical chart with the name          test_table_chart. At present, nosotros see the result of the query similar this:
            
          
Now allow's change our query in the virtual dataset by replacing          NOW()          function with          {{to_dttm}}          Jinja macro this way and salve:
              
            
If you try to run your chart now, information technology will return          Northward/A, because the template processor does not run across any fourth dimension range filter associated with this chart. To ready this, yous take to put together your chart with a filter on a new dashboard. If yous open your dashboard now, y'all will see the result of the query as we expected — the appointment that represents one twenty-four hour period before the terminate leap of the time range filter:
              
            
Wow, it is cool, isn't information technology? Play with the filter to check how information technology affects          test_table_chart.
In that location are many built-in macros available for templating. Yous know that HTML is rendered in the Tabular array visualization blazon, right? For instance, you could use          {{ url_param('your_custom_parameter') }}          for using custom GET request parameters in your dashboards and make them really interactive. You lot could construct links via          <a>          tags in your SQL similar this:
          SELECT <a href="http://superset?page=777">Page #777</a> AS MY_LINK                That link will lead a user to the detailed dashboard where the dataset is based on          {{ url_param('page') }}          which filled via Go parameter from your link!
Additional information on other built-in Jinja macros could be found in the jinja_context.py source lawmaking. Moreover, you could define your own macro and brand information technology available for templating in the dataset via TEMPLATE PARAMETERS in dataset properties. Fantastic!
I promise, y'all accept enjoyed the article and this slice of information will help y'all to build charming useful visualizations. If so, please, follow me on Medium, GitHub, Twitter, and LinkedIn.
Source: https://medium.com/geekculture/interactive-dashboards-in-apache-superset-ec4a3bf9bc82
Posted by: smithrandead53.blogspot.com

0 Response to "Who Repairs Dashboards In Atlanta"
Post a Comment