Sign up to take part
Registered users can ask their own questions, contribute to discussions, and be part of the Community!
Added on March 22, 2022 9:29PM
Likes: 0
Replies: 3
Hi,
Is there a way to add custom checks in the same way as adding metrics to a dataset through the dataset api ?
Thanks
Hi @dadbuz
,
You can add checks to a dataset via the api using get_settings() and save()
However to know the exact format of the check should first create the check you want manually on an existing dataset and then copy this to other datasets as needed.
For example, if I have the following 2 checks:
The get_settings() metricsChecks will return :
If I want to apply the same check to another dataset what I can do is :
import dataiku import pprint client = dataiku.api_client() project = client.get_default_project() def copy_checks_ds(source_dataset, destination_dataset): original_settings = project.get_dataset(source_dataset).get_settings().get_raw()['metricsChecks'] copy_to_dataset = project.get_dataset(destination_dataset) settings = copy_to_dataset.get_settings() params = settings.get_raw() params['metricsChecks'] = original_settings settings.save() # call copy copy_checks_ds("original_dataset_name","destination_dataset_name")
Let me know if that helps!
Thanks Alex!
I was looking at the wrong setting - 'checks' instead of 'metricsChecks';
Will test this and if it works I will accept the answer.