Skip to main content
Version: devel View Markdown

Deployments and configurations

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

Deployments​

Deployments​

The deployments of one workspace.

list() yields the newest version first.

Deployments.upload()​

upload(*, code: bytes | BinaryIO, requirements: bytes | BinaryIO) -> Deployment

Store a new version of the workspace's code.

The platform derives the hash, the size and the file list by reading the package. To skip an unchanged upload, compare the hash dlt's package builder returned with latest().content_hash.

Arguments

NameTypeDescription
codebytes | BinaryIOA deployment package built by dlt's package builder (a gzipped tar that carries dlt's manifest.yaml), as bytes or a binary file object.
requirementsbytes | BinaryIOThe requirements manifest that goes with it, as bytes or a binary file object. Opaque to the SDK.

Returns: Deployment — The stored deployment, one version above the last; 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.
DataplaneTokenRejectedThe data plane rejected the token the platform issued for it.
InvalidResponseThe platform returned an upload address this SDK version cannot use; upgrade dlthub-client.
NotAuthorizedThe caller lacks the access this call needs; message says why.
ScopeMissingReached without a workspace in scope.
TransportErrorThe upload did not complete. A version is written only once the content arrives, but a request that never produced a response cannot say whether it did — read latest() before retrying.

Deployments.get()​

get(*, version: int) -> Deployment

Return one deployment by version.

Arguments

NameTypeDescription
versionintThe version to read, counting up from 1.

Returns: Deployment — The deployment; awaitable in async mode.

Raises

ExceptionWhen
NotAuthorizedThe caller lacks the access this call needs; message says why.
NotFoundThe workspace has no such version.
ScopeMissingReached without a workspace in scope.

Deployments.latest()​

latest() -> Deployment

Return the deployment a run would use now.

Returns: Deployment — The newest version; awaitable in async mode.

Raises

ExceptionWhen
NotAuthorizedThe caller lacks the access this call needs; message says why.
NotFoundThe workspace has none yet.
ScopeMissingReached without a workspace in scope.

Deployments.count()​

count() -> int

Return how many versions the workspace holds.

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

Raises

ExceptionWhen
NotAuthorizedThe caller lacks the access this call needs; message says why.
ScopeMissingReached without a workspace in scope.

Deployments.list()​

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

Yield the workspace's deployments, paging lazily.

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[Deployment] | AsyncIterable[Deployment] — An iterable of deployments; async-iterable in async mode.

Raises

ExceptionWhen
NotAuthorizedThe caller lacks the access this call needs; message says why.
ScopeMissingReached without a workspace in scope.
ValueErrorA negative limit or offset.

Deployment​

One uploaded version of a workspace's code.

Attributes

NameTypeDescription
versionintVersion number within the workspace, starting at 1 and incremented by each upload.
idstrUnique ID (a UUID).
content_hashstrHash of the package contents: base64 SHA3-256 over each file's path and digest, as dlt computes when building the package; identical file sets give identical hashes.
file_countintNumber of files in the package.
size_bytesintSize of the uploaded package in bytes.
requirements_size_bytesintSize of the uploaded requirements file in bytes.
created_atdatetimeWhen it was created.
created_bystrThe organization_membership_id of the member who uploaded it.
updated_atdatetimeWhen it was last changed.

Deployment.files()​

files() -> tuple[FileEntry, ...]

List the files this deployment holds.

The manifest is stored with the content rather than with the record, so this is a fresh read every time.

Returns: tuple[FileEntry, ...] — One entry per file, in the platform's order; awaitable in async mode.

Raises

ExceptionWhen
DataplaneTokenRejectedThe data plane rejected the token the platform issued for it.
NotAuthorizedThe caller lacks the access this call needs; message says why.
NotFoundThe deployment no longer exists.
ScopeMissingReached without a workspace in scope.

Configurations​

Configurations​

The configurations of one workspace.

list() yields the newest version first.

Configurations.upload()​

upload(*, data: bytes | BinaryIO) -> Configuration

Store a new version of the workspace's configuration.

The platform reads the package for the hash, the file list and the profile names. To skip an unchanged upload, compare the hash dlt's package builder returned with latest().content_hash.

Arguments

NameTypeDescription
databytes | BinaryIOA configuration package built by dlt's package builder (a gzipped tar of the .dlt settings folder that carries dlt's manifest.yaml), as bytes or a binary file object.

Returns: Configuration — The stored configuration, one version above the last; 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.
DataplaneTokenRejectedThe data plane rejected the token the platform issued for it.
InvalidResponseThe platform returned an upload address this SDK version cannot use; upgrade dlthub-client.
NotAuthorizedThe caller lacks the access this call needs; message says why.
ScopeMissingReached without a workspace in scope.
TransportErrorThe upload did not complete. A version is written only once the content arrives, but a request that never produced a response cannot say whether it did — read latest() before retrying.

Configurations.get()​

get(*, version: int) -> Configuration

Return one configuration by version.

Arguments

NameTypeDescription
versionintThe version to read, counting up from 1.

Returns: Configuration — The configuration; awaitable in async mode.

Raises

ExceptionWhen
NotAuthorizedThe caller lacks the access this call needs; message says why.
NotFoundThe workspace has no such version.
ScopeMissingReached without a workspace in scope.

Configurations.latest()​

latest() -> Configuration

Return the configuration a run would use now.

Returns: Configuration — The newest version; awaitable in async mode.

Raises

ExceptionWhen
NotAuthorizedThe caller lacks the access this call needs; message says why.
NotFoundThe workspace has none yet.
ScopeMissingReached without a workspace in scope.

Configurations.count()​

count() -> int

Return how many versions the workspace holds.

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

Raises

ExceptionWhen
NotAuthorizedThe caller lacks the access this call needs; message says why.
ScopeMissingReached without a workspace in scope.

Configurations.list()​

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

Yield the workspace's configurations, paging lazily.

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[Configuration] | AsyncIterable[Configuration] — An iterable of configurations; async-iterable in async mode.

Raises

ExceptionWhen
NotAuthorizedThe caller lacks the access this call needs; message says why.
ScopeMissingReached without a workspace in scope.
ValueErrorA negative limit or offset.

Configuration​

One uploaded version of a workspace's configuration.

Attributes

NameTypeDescription
versionintVersion number within the workspace, starting at 1 and incremented by each upload.
idstrUnique ID (a UUID).
content_hashstrHash of the package contents: base64 SHA3-256 over each file's path and digest, as dlt computes when building the package; identical file sets give identical hashes.
file_countintNumber of files in the package.
size_bytesintSize of the uploaded package in bytes.
profilestuple[str, ...]Profile names found in <profile>.config.toml / <profile>.secrets.toml file names, sorted.
created_atdatetimeWhen it was created.
created_bystrThe organization_membership_id of the member who uploaded it.
updated_atdatetimeWhen it was last changed.

Configuration.files()​

files() -> tuple[FileEntry, ...]

List the files this configuration holds.

The manifest is stored with the content rather than with the record, so this is a fresh read every time.

Returns: tuple[FileEntry, ...] — One entry per file, in the platform's order; awaitable in async mode.

Raises

ExceptionWhen
DataplaneTokenRejectedThe data plane rejected the token the platform issued for it.
NotAuthorizedThe caller lacks the access this call needs; message says why.
NotFoundThe configuration no longer exists.
ScopeMissingReached without a workspace in scope.

Files​

FileEntry​

One file the platform holds for a deployment or a configuration.

Attributes

NameTypeDescription
relative_pathstrPath of the file inside the package, with / separators: relative to the workspace root for a deployment, and to the .dlt settings folder for a configuration.
size_bytesintSize of the file in bytes; 0 for a symlink.
sha3_256strBase64 SHA3-256 of the file contents, or of the linkname string for a symlink.
linknamestr | NoneSymlink target; set for symlink entries only.

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.