Add custom checks to dataset programatically
Anis
Dataiku DSS Core Designer, Dataiku DSS Adv Designer, Registered, Dataiku DSS Developer Posts: 18 ✭✭✭✭
Hi,
Is there a way to add custom checks in the same way as adding metrics to a dataset through the dataset api ?
Thanks
Tagged:
Best Answer
-
Alexandru Dataiker, Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Dataiku DSS Adv Designer, Registered Posts: 1,226 Dataiker
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!
Answers
-
Anis Dataiku DSS Core Designer, Dataiku DSS Adv Designer, Registered, Dataiku DSS Developer Posts: 18 ✭✭✭✭
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.