Use global variables in a Dashboard
![LouisDeville](https://us.v-cdn.net/6038231/uploads/Dataiku/nAvatar12.png)
Hi,
I am using a table from a dataset to make a dashboard and I want to show on it 3 things that are in global variables :
- The datasource name;
- The table name;
- The date the data was retrieve;
I wanted to do it using global varibles. However I don't know if it is even possible to do it so.
If there is an other way to do it (except adding an other column in my dataset because I have already 68 columns and more thant 200k rows) I'd be happy to read a better one.
Thanks !
Best Answer
-
Sarina Dataiker, Dataiku DSS Core Designer, Dataiku DSS Adv Designer, Registered Posts: 317 Dataiker
Hi @LouisDeville
,
Indeed unfortunately there isn't a way to display variables on a dashboard.
You can however display dataset Metrics on dashboards, which is likely the approach that makes the most sense here. Dataset metrics are found and configured in the dataset "Status" tab. The build date is one of the default metrics that is already computed.
For the table name and datasource name, you can create new Python probe metrics that simply return the value of your global variable.
Here's an example of returning a global variable named 'test' within a Python probe:import dataiku# Define here a function that returns the metric.def process(dataset, partition_id):# here 'test' is the name of my variableglobalvar = dataiku.get_custom_variables()['test']return {'globalvar' : globalvar}
To publish any metrics, you can do so directly from the metrics screen, or from the Dashboard > + Metrics selection.
I hope that's helpful, please let us know if you have any questions about this!
Thank you,
Sarina
Answers
-
Hello Sarina,
Thank you very much for your reply. Unfortunately, I can't test it at the moment, but it seems to work very well!
I hope it will be useful to others
Louis