Get list project by status

Solved!
arielma2304
Level 3
Get list project by status

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?

1 Solution
AgatheG
Dataiker

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.DSSP...).

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

View solution in original post

1 Reply
AgatheG
Dataiker

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.DSSP...).

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