teamspaces

client.teamspaces

TileDB Teamspaces

A teamspace is a container for assets and folders of assets. It will be backed by a unique cloud storage location and may be mounted as a directory in Notebooks and UDFs.

The TileDB web UI is the primary tool for managing teamspaces, but some functionality is available via this module.

Classes

Name Description
Teamspace Details about a teamspace and the user’s role in it.
TeamspacesError Raised when a teamspaces CRUD operation fails.

Teamspace

client.teamspaces.Teamspace()

Details about a teamspace and the user’s role in it.

To access more details about the user’s role, such as when it was updated, and by whom, use get_teamspace_user().

Attributes

Name Type Description
teamspace_id str The unique id of the teamspace.
name str The name of the workspace.
description str A description of the workspace.
icon str Teamspace icon URL.
created_at datetime When the workspace was created.
updated_at datetime When the workspace was last updated.
created_by TeamspaceUser The user and action that created the user-workspace relationship.
visibility TeamspaceVisibility Public or private.
default_storage_setting StorageSetting The teamspace’s default storage setting.
teamspace_role TeamspaceRole The current user’s role in the teamspace.

TeamspacesError

client.teamspaces.TeamspacesError()

Raised when a teamspaces CRUD operation fails.

Functions

Name Description
add_teamspace_members Add members to a teamspace.
create_teamspace Create a new teamspace in the current workspace.
delete_teamspace Delete a teamspace in the current workspace.
get_teamspace Retrieve the representation of a teamspace.
list_teamspace_members List teamspace members.
list_teamspaces List teamspaces of the current workspace.
remove_teamspace_members Remove members from a teamspace.
update_teamspace_member_roles Update member roles for a teamspace.

add_teamspace_members

client.teamspaces.add_teamspace_members(teamspace, members)

Add members to a teamspace.

Parameters

Name Type Description Default
teamspace TeamspaceLike The teamspace, identified by name, id, or object. required
members iterable An iterable sequence of (UserLike, TeamspaceRole) tuples. The first element may be an instance of User or WorkspaceUser, or a TileDB user id string. required

Raises

Name Type Description
TeamspacesError When members can not be added.

Examples

>>> add_teamspace_members("teamspace1", ["usr_123"])

Adds the user with id “usr_123” as a viewer to the teamspace named “teamspace1”.

create_teamspace

client.teamspaces.create_teamspace(
    name,
    *,
    description='New teamspace',
    visibility=TeamspaceVisibility.PRIVATE,
)

Create a new teamspace in the current workspace.

Parameters

Name Type Description Default
name str The name of the teamspace to create. required
description str Description of the teamspace to create. 'New teamspace'
visibility TeamspaceVisibility Private is the default, but teamspaces may be public. TeamspaceVisibility.PRIVATE

Returns

Name Type Description
Teamspace

Raises

Name Type Description
TeamspacesError: If the teamspace creation request failed.

Examples

>>> teamspace1 = teamspaces.create_teamspace(
...     "teamspace1",
...     description="Teamspace One",
...     visibility="private",
... )

delete_teamspace

client.teamspaces.delete_teamspace(teamspace, delete_assets=False)

Delete a teamspace in the current workspace.

Please note that this function may recursively deletes the teamspace’s assets and their object storage.

Parameters

Name Type Description Default
teamspace Teamspace or str The teamspace to delete, identified by name or id. required
delete_assets bool If True, the teamspace’s assets will be deregistered and deleted from the underlying storage (e.g., S3). If False, the entity’s assets will be deregistered, but remain in the underlying storage. Default: False. False

Raises

Name Type Description
TeamspacesError: If the teamspace deletion request failed.

Examples

>>> teamspaces.delete_teamspace("teamspace1")

get_teamspace

client.teamspaces.get_teamspace(teamspace)

Retrieve the representation of a teamspace.

Parameters

Name Type Description Default
teamspace str The teamspace to retrieve, by name or id. required

Raises

Name Type Description
TeamspacesError: If the teamspace retrieval request failed.

Examples

>>> teamspaces.get_teamspace("teamspace1")
Teamspace<>

list_teamspace_members

client.teamspaces.list_teamspace_members(
    teamspace,
    *,
    query=None,
    page=1,
    per_page=None,
)

List teamspace members.

Parameters

Name Type Description Default
teamspace str or object The teamspace to retrieve, by name, id, or object. required
query str Match users by name or email address. None

Returns

Name Type Description
Pager for TeamspaceUsers

Raises

Name Type Description
TeamspacesError: If the teamspace members listing request failed.

Examples

>>> for user in list_teamspace_members():
...     print(user.display_name)
...
A User

list_teamspaces

client.teamspaces.list_teamspaces(memberships=None, order_by=None, order=None)

List teamspaces of the current workspace.

This function can filter teamspaces based on the user’s membership and control the sorting of the results.

Parameters

Name Type Description Default
memberships bool If True, returns teamspaces the user is a member of. If False, returns public teamspaces in the workspace that the user is NOT a member of. If not provided (default), the API’s default behavior is used, which is typically to return all teamspaces the user has access to. None
order_by str The field to order the results by. Defaults to ‘created_at’. Valid values include ‘name’, ‘created_at’, ‘updated_at’. None
order str The sorting direction. Defaults to ‘desc’. Valid values are ‘asc’, ‘desc’. None

Returns

Name Type Description
list[Teamspace] A list of Teamspace objects.

Raises

Name Type Description
TeamspacesError If the teamspaces listing request failed.

Examples

List all teamspaces you are a member of

>>> my_teamspaces = teamspaces.list_teamspaces(memberships=True)
>>> [ts.name for ts in my_teamspaces]
["my-first-teamspace"]

List public teamspaces you are NOT a member of, ordered by name

>>> public_teamspaces = teamspaces.list_teamspaces(
...     memberships=False, order_by="name", order="asc"
... )

remove_teamspace_members

client.teamspaces.remove_teamspace_members(teamspace, members)

Remove members from a teamspace.

Parameters

Name Type Description Default
teamspace TeamspaceLike The teamspace, identified by name, id, or object. required
members iterable An iterable sequence of UserLike values. The values may be an instance of User or TeamspaceUser, or a TileDB user id string. required

Raises

Name Type Description
TeamspacesError When members can not be removed.

Examples

>>> remove_teamspace_members("teamspace1", ["usr_123"])

Removes the user with id “usr_123” from the teamspace named “teamspace1”.

update_teamspace_member_roles

client.teamspaces.update_teamspace_member_roles(teamspace, members)

Update member roles for a teamspace.

Parameters

Name Type Description Default
teamspace TeamspaceLike The teamspace, identified by name, id, or object. required
members iterable An iterable sequence of (UserLike, TeamspaceRole) tuples. The first element may be an instance of User or WorkspaceUser, or a TileDB user id string. required

Raises

Name Type Description
TeamspacesError When members can not be updated.

Examples

>>> update_teamspace_member_roles(
...     "teamspace1",
...     [("usr_123", role=TeamspaceRole.EDITOR)]
... )

Gives the user with id “usr_123” an editor role for the teamspace named “teamspace1”.