Skip to main content
Version: devel View Markdown

Organizations and workspaces

New to the SDK? Getting started shows how to connect and use it.

Organizations​

Organizations​

The organizations the caller belongs to.

Organizations.get()​

get(*, id: str) -> Organization

Return one organization by id.

Arguments

NameTypeDescription
idstrThe organization uuid.

Returns: Organization — The organization; awaitable in async mode.

Raises

ExceptionWhen
BadRequestThe request was rejected as invalid; message, code and fields say why.
NotAuthorizedThe caller lacks the access this call needs; message says why.
NotFoundNo such organization.

Organizations.count()​

count() -> int

Return how many organizations the caller belongs to.

Returns: int — The organization count; awaitable in async mode. Saturates at 10,001.

Organizations.list()​

list(
*,
limit: int | None = None,
offset: int = 0,
) -> Iterable[Organization] | AsyncIterable[Organization]

Yield the organizations the caller belongs to, paging lazily.

Needs no scope, so this is the entry point when the caller knows no ids yet.

Arguments

NameTypeDescription
limitint | NoneReturn at most this many. None walks to the end, or to row 10,100, past which the platform does not page.
offsetintSkip this many, server-side.

Returns: Iterable[Organization] | AsyncIterable[Organization] — An iterable of organizations; async-iterable in async mode.

Raises

ExceptionWhen
ValueErrorA negative limit or offset.

Organization​

An organization: what workspaces, members and billing hang off.

Collections

NameTypeExampleDescription
organization.workspacesWorkspacesorganization.workspaces.list()The workspaces in this organization.

Attributes

NameTypeDescription
idstrUnique ID (a UUID).
namestrThe name of the organization.
descriptionstr | NoneFree-text description of the organization; None when none is set.
dataplane_idstr | NoneData plane of the organization's workspaces; None until a region is set.
created_atdatetimeWhen it was created.

Organization.set_dataplane()​

set_dataplane(*, dataplane_id: str) -> Organization

Choose the data plane this organization's workspaces live on.

Must be set before the organization can hold any workspace, and it fixes where that data resides. One-time and irreversible.

Arguments

NameTypeDescription
dataplane_idstrThe data plane to assign.

Returns: Organization — A fresh snapshot; awaitable in async mode.

Raises

ExceptionWhen
BadRequestThe request was rejected as invalid; message, code and fields say why.
ConflictThe current state does not allow the call, e.g. the workspace is archived; code and message say why.
NotAuthorizedThe caller lacks the access this call needs; message says why.
NotFoundThe organization does not exist.

Organization.me()​

me() -> OrganizationCaller

Who the caller is here, what they may do, and where they belong.

One call, and it answers for an API key as well as a user token.

Returns: OrganizationCaller — The caller's identity, role, and workspace memberships in this organization; awaitable in async mode.

Raises

ExceptionWhen
NotAuthorizedThe caller lacks the access this call needs; message says why.
NotFoundThe organization no longer exists.

Membership​

A workspace the caller belongs to, and their role in it.

Attributes

NameTypeDescription
workspaceWorkspaceThe workspace, bound and ready to navigate from.
rolestrThe role of the user in the workspace.

OrganizationCaller​

Who the token belongs to, and what they may do in one organization.

Attributes

NameTypeDescription
emailstrThe email of the current user.
user_idstrThe ID of the current user.
organization_membership_idstrThe ID of the organization member for this organization.
rolestrThe role of the user in this organization.
workspace_membershipstuple[Membership, ...]The organization's workspaces the caller belongs to.

Workspaces​

Workspaces​

Workspace lookup, scoped by the context it is reached through.

Workspaces.create()​

create(
*,
name: str,
description: str | None = None,
organization_id: str | None = None,
) -> Workspace

Create a workspace in an organization.

Arguments

NameTypeDescription
namestrName for the new workspace. Names need not be unique.
descriptionstr | NoneFree-text description, or None for none.
organization_idstr | NoneOverrides the organization in scope. Required when the context carries none.

Returns: Workspace — The new workspace, scoped so its jobs are reachable; awaitable in async mode.

Raises

ExceptionWhen
BadRequestThe request was rejected as invalid; message, code and fields say why.
ConflictThe current state does not allow the call, e.g. the workspace is archived; code and message say why.
NotAuthorizedThe caller lacks the access this call needs; message says why.
NotFoundNo such organization.
ScopeMissingNo organization in scope and none passed.

Workspaces.get()​

get(*, id: str) -> Workspace

Return one workspace by id.

Arguments

NameTypeDescription
idstrThe workspace uuid.

Returns: Workspace — The workspace; awaitable in async mode.

Raises

ExceptionWhen
BadRequestThe request was rejected as invalid; message, code and fields say why.
NotAuthorizedThe caller lacks the access this call needs; message says why.
NotFoundNo such workspace.

Workspaces.count()​

count(*, organization_id: str | None = None) -> int

Count the workspaces of one organization, without fetching them.

Counts the live (unarchived) workspaces of the organization that the caller can see.

Arguments

NameTypeDescription
organization_idstr | NoneOverrides the organization in scope. Required when the context carries none.

Returns: int — The workspace count; awaitable in async mode. Saturates at 10,001.

Raises

ExceptionWhen
BadRequestThe request was rejected as invalid; message, code and fields say why.
NotAuthorizedThe caller lacks the access this call needs; message says why.
NotFoundNo such organization.
ScopeMissingNo organization in scope and none passed.

Workspaces.list()​

list(
*,
organization_id: str | None = None,
limit: int | None = None,
offset: int = 0,
) -> Iterable[Workspace] | AsyncIterable[Workspace]

Yield the workspaces of one organization, paging lazily.

Yields the live (unarchived) workspaces of the organization that the caller can see. Errors from the platform are raised when iteration begins.

Arguments

NameTypeDescription
organization_idstr | NoneOverrides the organization in scope. Required when the context carries none.
limitint | NoneReturn at most this many workspaces. None walks to the end, or to row 10,100, past which the platform does not page.
offsetintSkip this many workspaces, server-side.

Returns: Iterable[Workspace] | AsyncIterable[Workspace] — An iterable of workspaces; async-iterable in async mode.

Raises

ExceptionWhen
BadRequestThe request was rejected as invalid; message, code and fields say why.
NotAuthorizedThe caller lacks the access this call needs; message says why.
NotFoundNo such organization.
ScopeMissingNo organization in scope and none passed.
ValueErrorA negative limit or offset.

Workspace​

A workspace: the unit a job is deployed into.

Collections

NameTypeExampleDescription
workspace.job_runsJobRunsworkspace.job_runs.list()The job runs of this workspace, across all its jobs.
workspace.deploymentsDeploymentsworkspace.deployments.list()The versions of code this workspace has been given.
workspace.configurationsConfigurationsworkspace.configurations.list()The versions of configuration this workspace has been given.
workspace.telemetryTelemetryworkspace.telemetry.status()What the platform observed of the pipelines this workspace ran.
workspace.variablesVariablesworkspace.variables.list()The variables this workspace's job runs read.
workspace.jobsJobsworkspace.jobs.list()The jobs deployed in this workspace.

Attributes

NameTypeDescription
idstrUnique ID (a UUID).
namestrThe name of the workspace.
descriptionstr | NoneFree-text description of the workspace; None when none is set.
organization_idstrThe ID of the parent organization.
dataplane_idstrIdentifier of the data plane that holds this workspace's user data. Matches the subdomain of the plane's public entrypoint.
is_playgroundboolWhether this is the user's auto-created personal playground workspace. A playground has a single member and cannot be updated, archived, shared, or given API keys.
predefined_profilesMapping[str, str]Profile names the platform offers for this workspace, keyed by access level. Empty when it declares none.
created_atdatetimeWhen it was created.
archived_atdatetime | NoneWhen the workspace was archived; None when live. An archived workspace rejects all changes except unarchiving, though owners can still manage its workspace variables.
dashboard_urlstrWhere this workspace's dashboard lives in the web UI.

Workspace.update()​

update(*, name: str | Keep = KEEP, description: str | None | Keep = KEEP) -> Workspace

Change the workspace's name, its description, or both.

Arguments

NameTypeDescription
namestr | KeepNew name. Omit to leave it unchanged.
descriptionstr | None | KeepNew description. Pass None to clear it, omit to leave it unchanged.

Returns: Workspace — A fresh snapshot; awaitable in async mode.

Raises

ExceptionWhen
BadRequestThe request was rejected as invalid; message, code and fields say why.
ConflictThe current state does not allow the call, e.g. the workspace is archived; code and message say why.
NotAuthorizedThe caller lacks the access this call needs; message says why.
NotFoundThe workspace no longer exists.

Workspace.archive()​

archive() -> Workspace

Freeze the workspace: its schedules stop and it refuses changes.

Returns: Workspace — A fresh snapshot with archived_at set; awaitable in async mode.

Raises

ExceptionWhen
BadRequestThe request was rejected as invalid; message, code and fields say why.
ConflictThe current state does not allow the call, e.g. the workspace is archived; code and message say why.
NotAuthorizedThe caller lacks the access this call needs; message says why.
NotFoundThe workspace no longer exists.

Workspace.unarchive()​

unarchive() -> Workspace

Reopen an archived workspace and restart its schedules.

Returns: Workspace — A fresh snapshot with archived_at cleared; awaitable in async mode.

Raises

ExceptionWhen
ConflictThe current state does not allow the call, e.g. the workspace is archived; code and message say why.
NotAuthorizedThe caller lacks the access this call needs; message says why.
NotFoundThe workspace no longer exists.

Workspace.members()​

members(
*,
limit: int | None = None,
offset: int = 0,
) -> Iterable[WorkspaceMember] | AsyncIterable[WorkspaceMember]

Who has access to this workspace, and in what role.

Arguments

NameTypeDescription
limitint | NoneReturn at most this many. None walks to the end, or to row 10,100, past which the platform does not page.
offsetintSkip this many, server-side.

Returns: Iterable[WorkspaceMember] | AsyncIterable[WorkspaceMember] — An iterable of members; async-iterable in async mode.

Raises

ExceptionWhen
NotAuthorizedThe caller lacks the access this call needs; message says why.
ValueErrorA negative limit or offset.

Workspace.me()​

me() -> WorkspaceCaller

Who the caller is here, and what they may do.

One call, and it answers for an API key as well as a user token. Also records this workspace as the caller's most recent one, so Runtime.me() then reports its organization as latest_organization.

Returns: WorkspaceCaller — The caller's identity and roles; awaitable in async mode.

Raises

ExceptionWhen
NotAuthorizedThe caller lacks the access this call needs; message says why.
NotFoundThe workspace no longer exists.

WorkspaceCaller​

Who the token belongs to, and what they may do in one workspace.

Attributes

NameTypeDescription
emailstrThe email of the current user.
user_idstrThe ID of the current user.
organization_membership_idstrThe ID of the organization member in the parent organization.
organization_idstrUnique ID (a UUID).
organization_rolestrThe role of the user in the parent organization.
workspace_rolestrThe role of the user in this workspace.

WorkspaceMember​

One member of a workspace: a person or a service account (workspace API key).

Attributes

NameTypeDescription
emailstrThe email of the user.
user_idstrThe ID of the user.
rolestrThe role of the user in the workspace.
namestr | NoneDisplay name; None when the user has no name set.

Caller​

Caller​

The person the token belongs to.

Returned for a user token or a user API key; a service-account API key gets dlthub_sdk.NotAuthorized instead (see dlthub_sdk.Runtime.me()). Organization.me() and Workspace.me() answer for any caller.

Attributes

NameTypeDescription
emailstrThe email of the current user.
user_idstrThe ID of the current user.
organization_membership_idstrYour membership id in latest_organization.
namestr | NoneThe user's display name (full name); None if the identity provider supplied none.
primary_organizationOrganizationThe organization where new workspaces are created by default.
latest_organizationOrganizationThe organization you used most recently.
organization_membershipstuple[OrganizationMembership, ...]Every organization they belong to.

OrganizationMembership​

An organization the caller belongs to, and their role in it.

Attributes

NameTypeDescription
organizationOrganizationThe organization, bound and ready to navigate from.
rolestrThe role of the user in the organization.
is_activeboolWhether the membership is active.

Data planes​

Dataplanes​

The data planes this caller may choose from.

They arrive in one answer, so there is nothing to page and no count to ask for.

Dataplanes.list()​

list() -> tuple[Dataplane, ...]

Return every data plane available to this caller.

Needs no scope, like Organizations.list().

Returns: tuple[Dataplane, ...] — All of them, in the platform's order; awaitable in async mode.

Dataplane​

A data plane an organization can put its workspaces on.

Attributes

NameTypeDescription
idstrData plane id, e.g. eu1; also the subdomain of its URL.
namestrHuman-readable data plane name.
regionstrCloud region the data plane runs in, e.g. europe-west4.
descriptionstr | NoneOptional note about the data plane; None when there is none.

This demo works on codespaces. Codespaces is a development environment available for free to anyone with a Github account. You'll be asked to fork the demo repository and from there the README guides you with further steps.
The demo uses the Continue VSCode extension.

Off to codespaces!

DHelp

Ask a question

Welcome to "Codex Central", your next-gen help center, driven by OpenAI's GPT-4 model. It's more than just a forum or a FAQ hub – it's a dynamic knowledge base where coders can find AI-assisted solutions to their pressing problems. With GPT-4's powerful comprehension and predictive abilities, Codex Central provides instantaneous issue resolution, insightful debugging, and personalized guidance. Get your code running smoothly with the unparalleled support at Codex Central - coding help reimagined with AI prowess.