Survey banner
Switching to Dataiku - a new area to help users who are transitioning from other tools and diving into Dataiku! CHECK IT OUT

Compute Metrics using Python API

Solved!
sj0071992
Compute Metrics using Python API

Hi,

 

Is  there any way to run the compute button using python API to refresh the data size of dataset?

 

Thanks in Advance

0 Kudos
1 Solution
sergeyd
Dataiker

Hi @sj0071992 

Try this code using dataikuapi.dss.dataset.DSSDataset.compute_metrics : 

import dataiku

client = dataiku.api_client()
project = client.get_default_project()  # Get a handle to the current default project

ds = project.get_dataset("your-dataset")  # TODO: Change the dataset name

# Compute dataset metrics
ds.compute_metrics(
    # Change the example metric identifiers below to a subset of the ones you actually want to run
    metric_ids=['records:COUNT_RECORDS', 'basic:COUNT_COLUMNS']
)

# Run all the checks
ds.run_checks()

 

View solution in original post

1 Reply
sergeyd
Dataiker

Hi @sj0071992 

Try this code using dataikuapi.dss.dataset.DSSDataset.compute_metrics : 

import dataiku

client = dataiku.api_client()
project = client.get_default_project()  # Get a handle to the current default project

ds = project.get_dataset("your-dataset")  # TODO: Change the dataset name

# Compute dataset metrics
ds.compute_metrics(
    # Change the example metric identifiers below to a subset of the ones you actually want to run
    metric_ids=['records:COUNT_RECORDS', 'basic:COUNT_COLUMNS']
)

# Run all the checks
ds.run_checks()