Workspaces¶
You can interact with the Workspaces through the API.
Basic operations¶
Listing workspaces¶
workspaces = client.list_workspaces(True)
# Returns a list of DSSWorkspace
for workspace in workspaces:
# Access to main information in the workspace
print("Workspace key: %s" % workspace.workspace_key)
print("Display name: %s" % workspace.get_settings().display_name)
print("Description: %s" % workspace.get_settings().description)
print("Permissions: %s" % workspace.get_settings().permissions) # Returns a list of DSSWorkspacePermissionItem
# You can also list the objects in a workspaces
print("Objects: %s" % workspace.list_objects())
Modifying workspace¶
workspace = client.get_workspace("WORKSPACE_KEY")
settings = workspace.get_settings()
settings.permissions = [*settings.permissions, DSSWorkspacePermissionItem.member_user("LOGIN"), DSSWorkspacePermissionItem.contributor_group("GROUP")]
settings.save()
Deleting a workspace¶
workspace = client.get_workspace("WORKSPACE_KEY")
workspace.delete()
Adding and deleting the objects in a workspace¶
workspace = client.get_workspace("WORKSPACE_KEY")
workspace_objects = workspace.list_objects()
for workspace_object in workspace_objects
workspace_object.delete()
workspace.add_object(client.get_project("PROJECT_KEY").get_dataset("DATASET_NAME")) # To add a dataset
workspace.add_object(client.get_project("PROJECT_KEY").get_wiki("WIKI").get_article("ARTICLE")) # To add an article
workspace.add_object(client.get_app("APP_ID")) # To add an app
workspace.add_object({"htmlLink": {"name": "Dataiku", "url": "https://www.dataiku.com/", "description": "Dataiku website"}}) # You can also specify the content as a dict, here we add a link
Reference documentation¶
-
class
dataikuapi.dss.workspace.
DSSWorkspace
(client, workspace_key)¶ A handle to interact with a workspace on the DSS instance.
Do not create this class directly, instead use
dataikuapi.DSSClient.get_workspace()
-
get_settings
()¶ Gets the settings of this workspace.
- Returns
a handle to read, modify and save the settings
- Return type
-
list_objects
()¶ List the objects in this workspace
- Returns
The list of the objects
- Return type
list of
DSSWorkspaceObject
-
add_object
(object)¶ Add an object to this workspace. Object can be of different shapes (
dataikuapi.dss.dataset.DSSDataset
,dataikuapi.dss.wiki.DSSWikiArticle
,dataikuapi.dss.app.DSSApp
,DSSWorkspaceHtmlLinkObject
or adict
that contains the raw data)
-
delete
()¶ Delete the workspace
This call requires Administrator rights on the workspace.
-
-
class
dataikuapi.dss.workspace.
DSSWorkspaceObject
(workspace, data)¶ A handle on an object of a workspace
Do not create this class directly, instead use
dataikuapi.dss.DSSWorkspace.list_objects()
-
get_raw
()¶
-
remove
()¶ Remove this object from the workspace
This call requires Contributor rights on the workspace.
-
-
class
dataikuapi.dss.workspace.
DSSWorkspaceSettings
(workspace, settings)¶ A handle on the settings of a workspace
Do not create this class directly, instead use
dataikuapi.dss.DSSWorkspace.get_settings()
-
get_raw
()¶
-
property
display_name
¶ Get or set the name of the workspace
- Return type
str
-
property
color
¶ Get or set the background color of the workspace (using #xxxxxx syntax)
- Return type
str
-
property
description
¶ Get or set the description of the workspace
- Return type
str
-
property
permissions
¶ Get or set the permissions controlling who is a member, contributor or admin of the workspace
- Return type
list of
DSSWorkspacePermissionItem
-
property
current_user_permissions
¶ Permissions of the current user (read-only)
- Return type
-
save
()¶ Save the changes made on the settings
This call requires Administrator rights on the workspace.
-
-
class
dataikuapi.dss.workspace.
DSSWorkspacePermissionItem
(data)¶ -
classmethod
admin_group
(group)¶
-
classmethod
contributor_group
(group)¶
-
classmethod
member_group
(group)¶
-
classmethod
admin_user
(user)¶
-
classmethod
contributor_user
(user)¶
-
classmethod
member_user
(user)¶
-
property
user
¶ Get user login
- Return type
str
-
property
group
¶ Get group name
- Return type
str
-
property
admin
¶ Get admin permission
- Return type
boolean
-
property
write
¶ Get write permission
- Return type
boolean
-
property
read
¶ Get read permission
- Return type
boolean
-
classmethod