Use global variables in a Dashboard

LouisDeville
LouisDeville Registered Posts: 2

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
    Sarina Dataiker, Dataiku DSS Core Designer, Dataiku DSS Adv Designer, Registered Posts: 317 Dataiker
    Answer ✓

    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}

    Screenshot 2023-06-02 at 5.31.58 PM.png

    To publish any metrics, you can do so directly from the metrics screen, or from the Dashboard > + Metrics selection.

    Screenshot 2023-06-02 at 5.32.16 PM.png

    I hope that's helpful, please let us know if you have any questions about this!

    Thank you,
    Sarina

Answers

Setup Info
    Tags
      Help me…