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.
root_folder = client.get_root_project_folder()
Alternatively any project folder can be retrieved with its ID with the get_project_folder method.
prj_folder = client.get_project_folder(prj_folder_id)
Getting basic attributes:
# Getting the id of a project folder (for "get_project_folder")
id = prj_folder.id
# Getting the name of a project folder:
name = prj_folder.name
# Getting the "virtual path" of a project folder (NB: for information purpose only, does not hold special significance)
path = prj_folder.get_path()
Finding the folder of a project¶
From a project, you can find its project folder
project = client.get_project("MYPROJECT")
folder = project.get_project_folder()
print("Project is in folder %s (path %s)" % (folder.name, folder.get_path()))
Creating entities¶
To create a child project folder, use the create_sub_folder method.
# Creating a new project folder
newborn_child = prj_folder.create_sub_folder(project_folder_name)
# Creating a project directly into a project folder
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)
prj_folder.move_project_to(project_key, new_parent)
You can also move a project directly
project.move_to_folder(target_folder)
Managing project folders¶
Deleting a project folder¶
prj_folder.delete()
Modifying settings¶
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, data)¶ 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()
ordataikuapi.DSSClient.get_root_project_folder()
-
property
id
¶ Get this project folder’s id :returns str: the id of this project folder
-
property
project_folder_id
¶ deprecated, use id instead
-
property
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_name
()¶ See name
-
get_path
()¶ Get this project folder’s path from the orot, in the form of /name/name/name :return 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
-
property
-
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
-