Project folders

You can interact with project folders through the API.

Basic operations

The ROOT project folder can be retrieved with the get_root_project_folder method.

client = DSSClient(host, apiKey)
root_folder = client.get_root_project_folder()

Alternatively any project folder can be retrieved with its ID with the get_project_folder method.

client = DSSClient(host, apiKey)
prj_folder = client.get_project_folder(prj_folder_id)

The name and path of a project folder can be retrived.

name = prj_folder.get_name()
path = prj_folder.get_path()

Creating entities

To create a child project folder, use the create_sub_folder method.

newborn_child = prj_folder.create_sub_folder(project_folder_name)

Projects can be created the same way using the create_project method.

new_project = prj_folder.create_project(project_key, project_name, owner)

Moving entities

To move a project folder to another location (into another project folder), use the move_to method.

prj_folder.move_to(new_parent)

Similarly projects can be moved to another location (into another project folder), use the move_project_to method.

prj_folder.move_project_to(project_key, new_parent)

Managing project folders

One can delete an empty project folder with sufficient permissions.

prj_folder.delete()

In order to edit its name, or its permissions, one must get the project folder settings beforehand.

pf_settings = prj_folder.get_settings()
pf_settings.set_name(new_name)
pf_settings.set_owner(new_owner)
pf_permissions = pf_settings.get_permissions()
pf_permissions.append(new_permission_item)
pf_settings.save()

Reference documentation

class dataikuapi.dss.projectfolder.DSSProjectFolder(client, project_folder_id)

A handle to interact with a project folder on the DSS instance.

Do not create this class directly, instead use dataikuapi.DSSClient.get_project_folder() or dataikuapi.DSSClient.get_root_project_folder()

get_name()

Get this project folder’s name or None if it is the root project folder

Returns str:the name of this project folders or None for the root project folder
get_path()

Get this project fodler’s path based on the root project folder

Returns str:the path of this project folder
get_parent()

Get this project folder’s parent or None if it is the root project folder

Returns:A dataikuapi.dss.projectfolders.DSSProjectFolder to interact with its parent or None for the root project folder
list_child_folders()

List the child project folders inside this project folder

Returns list:A list of dataikuapi.dss.projectfolders.DSSProjectFolder to interact with its sub-folders
list_project_keys()

List the project keys of the projects that are stored in this project folder

Returns list:A list of project keys
list_projects()

List the projects that are stored in this project folder

Returns list:A list of dataikuapi.dss.project.DSSProject to interact with its projects
delete()

Delete the project folder Note: it must be empty (cannot contain any sub-project folders or projects), you must move or remove all its content before deleting it

This call requires an API key with admin rights

get_settings()
Returns:A dataikuapi.dss.projectfolder.DSSProjectFolderSettings to interact with this project folder settings
create_sub_folder(name)

Create a sub-folder into the current project folder

Parameters:name (str) – the name of the project folder to create
Returns:A dataikuapi.dss.projectfolder.DSSProjectFolder to interact with the newly created project folder
create_project(project_key, name, owner, description=None, settings=None)

Creates a new project within this project folder, and return a project handle to interact with it.

Note: this call requires an API key with admin rights or the rights to create a project

Parameters:
  • project_key (str) – the identifier to use for the project. Must be globally unique
  • name (str) – the display name for the project.
  • owner (str) – the login of the owner of the project.
  • description (str) – a description for the project.
  • settings (dict) – Initial settings for the project (can be modified later). The exact possible settings are not documented.
Returns:

A class:dataikuapi.dss.project.DSSProject project handle to interact with this project

move_to(destination)

Move this project folder into another project folder (aka. destination)

Parameters:destination (A dataikuapi.dss.projectfolders.DSSProjectFolder) – the project folder to put this project folder into
move_project_to(project_key, destination)

Move a project within this project folder into another project folder (aka. destination)

Parameters:
  • project_key (str) – the project key associated with the project to move
  • destination (A dataikuapi.dss.projectfolders.DSSProjectFolder) – the project folder to put this project into
class dataikuapi.dss.projectfolder.DSSProjectFolderSettings(client, project_folder_id, settings)

A handle to interact with project folder settings

Do not create this class directly, instead use dataikuapi.dss.projectfolder.DSSProjectFolder.get_settings()

get_raw()

Gets all settings as a raw dictionary. This returns a reference to the raw retrieved settings, not a copy, so changes made to the returned object will be reflected when saving.

Return type:dict
get_name()

Get the name of the project folder

Returns str:the current name of the project folder
set_name(name)

Set the name of the project folder

Parameters:name (str) – the new name of the project folder
get_owner()

Get the login of the owner of the project folder

Returns str:the current login owner of the project folder
set_owner(owner)

Set the owner of the project folder

Parameters:owner (str) – the new owner login of the project folder
get_permissions()

Get the permissions of the project folder. This returns a reference to the retrieved permissions, not a copy, so changes made to the returned list will be reflected when saving.

Return list:the current permissions of the project folder
save()

Saves back the settings to the project folder