Skip to main content
Version: 1.33.0 (latest) 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. Async mode returns an awaitable.

Raises

ExceptionWhen
BadRequestThe runtime rejected the request as invalid. message, code and fields say why.
NotAuthorizedThe caller lacks the access that this call needs. message says why.
NotFoundThe organization does not exist.

Organizations.count()​

count() -> int

Return how many organizations the caller belongs to.

Returns: int — The organization count, which saturates at 10,001. Async mode returns an awaitable.

Organizations.list()​

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

Yield the organizations that the caller belongs to, page by page.

It needs no scope, so it is the entry point when the caller knows no IDs yet.

Arguments

NameTypeDescription
limitint | NoneThe most items to return. None returns every item up to item 10,100, where the runtime stops paging.
offsetintThe number of items that the runtime skips first.

Returns: Iterable[Organization] | AsyncIterable[Organization] — An iterable of organizations. Async mode returns an async iterable.

Raises

ExceptionWhen
ValueErrorA negative limit or offset.

Organization​

An organization: the tenant that owns workspaces, members and billing.

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

Set the data plane that holds the workspaces of this organization.

The organization needs a data plane before it can hold a workspace. The data plane fixes where the data of the workspaces resides. The choice is final.

Arguments

NameTypeDescription
dataplane_idstrThe data plane to assign.

Returns: Organization — A fresh snapshot. Async mode returns an awaitable.

Raises

ExceptionWhen
BadRequestThe runtime rejected the request as invalid. message, code and fields say why.
ConflictThe organization already has a data plane.
NotAuthorizedThe caller lacks the access that this call needs. message says why.
NotFoundThe organization does not exist.

Organization.me()​

me() -> OrganizationCaller

Return who the caller is in this organization, with role and workspaces.

It works for an API key and for a user token.

Returns: OrganizationCaller — The identity, role and workspace memberships of the caller in this organization. Async mode returns an awaitable.

Raises

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

Membership​

A workspace that the caller belongs to, with the role of the caller.

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 the caller can 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 workspaces of the organization that the caller belongs to.

Workspaces​

Workspaces​

The workspaces of an organization, scoped by the context that reaches them.

Workspaces.create()​

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

Create a workspace in an organization.

Arguments

NameTypeDescription
namestrName of the new workspace. Names do not have to 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 that its jobs are reachable. Async mode returns an awaitable.

Raises

ExceptionWhen
BadRequestThe runtime rejected the request as invalid. message, code and fields say why.
ConflictThe organization has no data plane yet, or a trial organization already has its workspace. code and message say why.
NotAuthorizedThe caller lacks the access that this call needs. message says why.
NotFoundThe organization does not exist.
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. Async mode returns an awaitable.

Raises

ExceptionWhen
BadRequestThe runtime rejected the request as invalid. message, code and fields say why.
NotAuthorizedThe caller lacks the access that this call needs. message says why.
NotFoundThe workspace does not exist.

Workspaces.count()​

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

Count the workspaces of one organization, without reading them.

It 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, which saturates at 10,001. Async mode returns an awaitable.

Raises

ExceptionWhen
BadRequestThe runtime rejected the request as invalid. message, code and fields say why.
NotAuthorizedThe caller lacks the access that this call needs. message says why.
NotFoundThe organization does not exist.
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, page by page.

It yields the live (unarchived) workspaces of the organization that the caller can see. Errors from the runtime raise when the iteration starts.

Arguments

NameTypeDescription
organization_idstr | NoneOverrides the organization in scope. Required when the context carries none.
limitint | NoneThe most workspaces to return. None returns every workspace up to item 10,100, where the runtime stops paging.
offsetintThe number of workspaces that the runtime skips first.

Returns: Iterable[Workspace] | AsyncIterable[Workspace] — An iterable of workspaces. Async mode returns an async iterable.

Raises

ExceptionWhen
BadRequestThe runtime rejected the request as invalid. message, code and fields say why.
NotAuthorizedThe caller lacks the access that this call needs. message says why.
NotFoundThe organization does not exist.
ScopeMissingNo organization in scope and none passed.
ValueErrorA negative limit or offset.

Workspace​

A workspace: the unit that holds deployed jobs.

Collections

NameTypeExampleDescription
workspace.job_runsJobRunsworkspace.job_runs.list()The job runs of this workspace, across all its jobs.
workspace.deploymentsDeploymentsworkspace.deployments.list()The code versions uploaded to this workspace.
workspace.configurationsConfigurationsworkspace.configurations.list()The configuration versions uploaded to this workspace.
workspace.telemetryTelemetryworkspace.telemetry.status()What the runtime recorded about the pipeline runs of this workspace.
workspace.variablesVariablesworkspace.variables.list()The variables that the job runs of this workspace 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]Deprecated and always empty. A job definition declares its data access.
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_urlstrThe page of this workspace in the dltHub web app.

Workspace.update()​

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

Change the name of the workspace, its description, or both.

Arguments

NameTypeDescription
namestr | KeepNew name. KEEP, the default, leaves it unchanged.
descriptionstr | None | KeepNew description. None clears it, and KEEP leaves it unchanged.

Returns: Workspace — A fresh snapshot. Async mode returns an awaitable.

Raises

ExceptionWhen
BadRequestThe runtime rejected the request as invalid. message, code and fields say why.
ConflictThe current state does not allow the call, for example an archived workspace. code and message say why.
NotAuthorizedThe caller lacks the access that 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. Async mode returns an awaitable.

Raises

ExceptionWhen
BadRequestThe runtime rejected the request as invalid. message, code and fields say why.
ConflictThe workspace is already archived, or a job run in it is still active. code and message say why.
NotAuthorizedThe caller lacks the access that 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. Async mode returns an awaitable.

Raises

ExceptionWhen
ConflictThe workspace is not archived.
NotAuthorizedThe caller lacks the access that 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]

Yield the members of this workspace, with their roles.

Arguments

NameTypeDescription
limitint | NoneThe most items to return. None returns every item up to item 10,100, where the runtime stops paging.
offsetintThe number of items that the runtime skips first.

Returns: Iterable[WorkspaceMember] | AsyncIterable[WorkspaceMember] — An iterable of members. Async mode returns an async iterable.

Raises

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

Workspace.me()​

me() -> WorkspaceCaller

Return who the caller is in this workspace, and what the caller can do.

It works for an API key and for a user token. It also records this workspace as the latest one of the caller, so Runtime.me() then reports its organization as latest_organization.

Returns: WorkspaceCaller — The identity and roles of the caller. Async mode returns an awaitable.

Raises

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

WorkspaceCaller​

Who the token belongs to, and what the caller can 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_idstrThe ID of the parent organization.
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 that the token belongs to.

A user token or a personal API key gets it. A workspace 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 that the user belongs to, with the role of the user.

OrganizationMembership​

An organization that the caller belongs to, with the role of the caller.

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 that this caller can choose from.

The runtime returns them in one response, so there is nothing to page and no count.

Dataplanes.list()​

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

Return every data plane available to this caller.

It needs no organization or workspace, like Organizations.list().

Returns: tuple[Dataplane, ...] — All of them, in the order of the runtime. Async mode returns an awaitable.

Dataplane​

A data plane that an organization can use for its workspaces.

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.