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 code of the workspace.

The runtime derives the hash, the size and the file list from the package. An unchanged upload has the same hash as latest().content_hash, so a caller can skip it.

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 that go with it, as bytes or a binary file object. Opaque to the SDK.

Returns: Deployment — The stored deployment, one version after the latest. 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.
DataplaneTokenRejectedThe data plane rejected the token that the runtime issued for it.
InvalidResponseThe runtime returned an upload address that this SDK version cannot use. A newer dlthub-client can use it.
NotAuthorizedThe caller lacks the access that this call needs. message says why.
ScopeMissingNo workspace in scope.
TransportErrorThe upload did not complete. The runtime writes a version only after the content arrives. Without a response, the SDK cannot tell if it arrived. latest() shows if the version exists.

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. Async mode returns an awaitable.

Raises

ExceptionWhen
NotAuthorizedThe caller lacks the access that this call needs. message says why.
NotFoundThe workspace has no such version.
ScopeMissingNo workspace in scope.

Deployments.latest()​

latest() -> Deployment

Return the deployment that a new job run uses.

Returns: Deployment — The newest version. Async mode returns an awaitable.

Raises

ExceptionWhen
NotAuthorizedThe caller lacks the access that this call needs. message says why.
NotFoundThe workspace has none yet.
ScopeMissingNo workspace in scope.

Deployments.count()​

count() -> int

Return how many versions the workspace holds.

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

Raises

ExceptionWhen
NotAuthorizedThe caller lacks the access that this call needs. message says why.
ScopeMissingNo workspace in scope.

Deployments.list()​

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

Yield the deployments of the workspace, page by page.

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

Raises

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

Deployment​

One uploaded version of the code of a workspace.

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 that this deployment holds.

The runtime stores the file list with the content, not with the record. So every call reads it again.

Returns: tuple[FileEntry, ...] — One entry per file, in the order of the runtime. Async mode returns an awaitable.

Raises

ExceptionWhen
DataplaneTokenRejectedThe data plane rejected the token that the runtime issued for it.
NotAuthorizedThe caller lacks the access that this call needs. message says why.
NotFoundThe deployment no longer exists.
ScopeMissingNo 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 configuration of the workspace.

The runtime reads the hash, the file list and the profile names from the package. An unchanged upload has the same hash as latest().content_hash, so a caller can skip it.

Arguments

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

Returns: Configuration — The stored configuration, one version after the latest. 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.
DataplaneTokenRejectedThe data plane rejected the token that the runtime issued for it.
InvalidResponseThe runtime returned an upload address that this SDK version cannot use. A newer dlthub-client can use it.
NotAuthorizedThe caller lacks the access that this call needs. message says why.
ScopeMissingNo workspace in scope.
TransportErrorThe upload did not complete. The runtime writes a version only after the content arrives. Without a response, the SDK cannot tell if it arrived. latest() shows if the version exists.

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. Async mode returns an awaitable.

Raises

ExceptionWhen
NotAuthorizedThe caller lacks the access that this call needs. message says why.
NotFoundThe workspace has no such version.
ScopeMissingNo workspace in scope.

Configurations.latest()​

latest() -> Configuration

Return the configuration that a new job run uses.

Returns: Configuration — The newest version. Async mode returns an awaitable.

Raises

ExceptionWhen
NotAuthorizedThe caller lacks the access that this call needs. message says why.
NotFoundThe workspace has none yet.
ScopeMissingNo workspace in scope.

Configurations.count()​

count() -> int

Return how many versions the workspace holds.

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

Raises

ExceptionWhen
NotAuthorizedThe caller lacks the access that this call needs. message says why.
ScopeMissingNo workspace in scope.

Configurations.list()​

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

Yield the configurations of the workspace, page by page.

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

Raises

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

Configuration​

One uploaded version of the configuration of a workspace.

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 that this configuration holds.

The runtime stores the file list with the content, not with the record. So every call reads it again.

Returns: tuple[FileEntry, ...] — One entry per file, in the order of the runtime. Async mode returns an awaitable.

Raises

ExceptionWhen
DataplaneTokenRejectedThe data plane rejected the token that the runtime issued for it.
NotAuthorizedThe caller lacks the access that this call needs. message says why.
NotFoundThe configuration no longer exists.
ScopeMissingNo workspace in scope.

Files​

FileEntry​

One file that the runtime 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.