Copying / saving Checks and metrics

Solved!
manssari
Level 2
Copying / saving Checks and metrics

Hello,

Is there any way to copy checks and metrics from one data set to another?
Is it possible to save a custom code check as a plugin ?


Operating system used: Centos 7

0 Kudos
1 Solution
MiguelangelC
Dataiker

Hi,

Using the Python API you can copy the metrics/checks metadata from a dataset:

import dataiku
client=dataiku.api_client()
project=client.get_project(dataiku.default_project_key())
sourcedataset=project.get_dataset("<source dataset name>")
wantedmetrics=sourcedataset.get_settings().get_raw()["metrics"]
wantedchecks=sourcedataset.get_settings().get_raw()["metricsChecks"]

And apply them to any other dataset in the node. For example, to apply them to a dataset in the same project:

targetdataset=project.get_dataset("<target dataset name>")
datasetsettings=targetdataset.get_definition()
datasetsettings["metrics"]=wantedmetrics
datasetsettings["metricsChecks"]=wantedchecks
targetdataset.set_definition(datasetsettings)

Regadring plugins, in the plugin components you can see two components to develop metrics and checks probes:

Captur1e.PNG

View solution in original post

2 Replies
MiguelangelC
Dataiker

Hi,

Using the Python API you can copy the metrics/checks metadata from a dataset:

import dataiku
client=dataiku.api_client()
project=client.get_project(dataiku.default_project_key())
sourcedataset=project.get_dataset("<source dataset name>")
wantedmetrics=sourcedataset.get_settings().get_raw()["metrics"]
wantedchecks=sourcedataset.get_settings().get_raw()["metricsChecks"]

And apply them to any other dataset in the node. For example, to apply them to a dataset in the same project:

targetdataset=project.get_dataset("<target dataset name>")
datasetsettings=targetdataset.get_definition()
datasetsettings["metrics"]=wantedmetrics
datasetsettings["metricsChecks"]=wantedchecks
targetdataset.set_definition(datasetsettings)

Regadring plugins, in the plugin components you can see two components to develop metrics and checks probes:

Captur1e.PNG

manssari
Level 2
Author

Thank you Miguel !

0 Kudos