Script to delete multiple project

SAURABH
SAURABH Partner, Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Dataiku DSS Core Concepts, Dataiku DSS Adv Designer, Registered Posts: 26 Partner

Hi Team

is there a way to delete multiple projects in one go


Operating system used: linux

Answers

  • Catalina
    Catalina Dataiker, Dataiku DSS Core Designer, Registered Posts: 135 Dataiker
    edited July 17

    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.

Setup Info
    Tags
      Help me…