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#
from dataikuapi.dss.workspace import DSSWorkspacePermissionItem
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.remove()
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().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#
A handle to interact with a workspace on the DSS instance. |
|
A handle on an object of a workspace |
|
A handle on the settings of a workspace |
|