Get list project by status

Options
arielma2304
arielma2304 Registered Posts: 47 ✭✭✭✭

Hi

Is there a way to get list of project thought API by their status? for example only the ones which are in status 'In production'? otherwise, can we get it from the project metadata?

and other question in the same area. In DSS UI, there is an option to create folder. If for example I create folder named 'Production', is there a way to tell the API to list the projects which stored only in this folder?

Best Answer

  • AgatheG
    AgatheG Dataiker Posts: 37 Dataiker
    edited July 17 Answer ✓
    Options

    Hi!

    1. When it exists, the status is stored at the name "projectStatus" in a project settings, so you can filter the project list as follow usijg the Python API:

    import dataiku
    
    client = dataiku.api_client()
    projects = client.list_projects()
    status = "..." # whatever your status is, e.g. "In production"
    filtered_projects = [project for project in projects if project.get("projectStatus") == status]

    2. You can retrieve the list of the projects in a specific folder using the method `list_projects`
    (see here in the documentation: https://doc.dataiku.com/dss/latest/python-api/project-folders.html#dataikuapi.dss.projectfolder.DSSProjectFolder.list_projects).

    So you can do something like this:

    prj_folder = client.get_project_folder(YOUR_FOLDER_ID)
    project_list = prj_folder.list_projects()

    Using your folder id as YOUR_FOLDER_ID, like "Production" in your case.

    Hope this helps!

    Agathe

Setup Info
    Tags
      Help me…