Discover all of the brand-new features and improvements to existing capabilities in the Dataiku 11.3 updateLET'S GO

Script to delete multiple project

saurabh
Level 2
Script to delete multiple project

Hi Team

is there a way to delete multiple projects in one go


Operating system used: linux

0 Kudos
1 Reply
CatalinaS
Dataiker

Hi @saurabh,

You can create a Python script that makes use of Dataiku Python API to delete multiple projects at once. Below is an example code that can be used to delete the projects corresponding to the project keys defined in the input list project_key.

import dataikuapi

host="http://localhost:11200"
apiKey = "*************"
project_keys=["TESTDELETE", "TESTDELETE2"]


def delete_projects(project_keys):
    client = dataikuapi.DSSClient(host,apiKey)
    dss_projects = client.list_project_keys()
    for key in project_keys:
        if key in dss_projects:
            project = client.get_project(key)
            project.delete()
            print("Project" + key + "deleted")

delete_projects(project_keys) 

Please note that delete project call requires an API key with admin rights.

0 Kudos