Compute Metrics using Python API

sj0071992
sj0071992 Partner, Dataiku DSS Core Designer, Neuron, Dataiku DSS Adv Designer, Registered, Dataiku DSS Developer, Neuron 2022, Neuron 2023 Posts: 131 Neuron

Hi,

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

Thanks in Advance

Tagged:

Best Answer

  • Sergey
    Sergey Dataiker, Dataiku DSS Core Designer, Dataiku DSS & SQL, Dataiku DSS Core Concepts Posts: 365 Dataiker
    edited July 17 Answer ✓

    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()
    

Setup Info
    Tags
      Help me…