---
title: Deployments and configurations
description: Deployments and configurations in the dltHub Runtime Python SDK (dlthub_sdk)
keywords: [dlthub, runtime, python sdk, dlthub_sdk, api]
---
# Deployments and configurations

<!-- generated from dlthub-client 0.33.1, do not edit -->

New to the SDK? [Getting started](getting-started.md) shows how to connect and use it.

## Deployments

### `Deployments` {#deployments}

The deployments of one workspace.

`list()` yields the newest version first.

#### `Deployments.upload()` {#deployments-upload}

```python
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**

| Name | Type | Description |
| --- | --- | --- |
| `code` | <code>bytes &#124; BinaryIO</code> | A deployment package built by dlt's package builder (a gzipped tar that carries dlt's `manifest.yaml`), as bytes or a binary file object. |
| `requirements` | <code>bytes &#124; BinaryIO</code> | The requirements that go with it, as bytes or a binary file object. Opaque to the SDK. |

**Returns:** <code><a href="#deployment">Deployment</a></code> — The stored deployment, one version after the latest. Async mode returns an awaitable.

**Raises**

| Exception | When |
| --- | --- |
| [`BadRequest`](errors.md#badrequest) | The runtime rejected the request as invalid. `message`, `code` and `fields` say why. |
| [`Conflict`](errors.md#conflict) | The current state does not allow the call, for example an archived workspace. `code` and `message` say why. |
| [`DataplaneTokenRejected`](errors.md#dataplanetokenrejected) | The data plane rejected the token that the runtime issued for it. |
| [`InvalidResponse`](errors.md#invalidresponse) | The runtime returned an upload address that this SDK version cannot use. A newer `dlthub-client` can use it. |
| [`NotAuthorized`](errors.md#notauthorized) | The caller lacks the access that this call needs. `message` says why. |
| [`ScopeMissing`](errors.md#scopemissing) | No workspace in scope. |
| [`TransportError`](errors.md#transporterror) | The 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()` {#deployments-get}

```python
get(*, version: int) -> Deployment
```

Return one deployment by version.

**Arguments**

| Name | Type | Description |
| --- | --- | --- |
| `version` | <code>int</code> | The version to read, counting up from 1. |

**Returns:** <code><a href="#deployment">Deployment</a></code> — The deployment. Async mode returns an awaitable.

**Raises**

| Exception | When |
| --- | --- |
| [`NotAuthorized`](errors.md#notauthorized) | The caller lacks the access that this call needs. `message` says why. |
| [`NotFound`](errors.md#notfound) | The workspace has no such version. |
| [`ScopeMissing`](errors.md#scopemissing) | No workspace in scope. |

#### `Deployments.latest()` {#deployments-latest}

```python
latest() -> Deployment
```

Return the deployment that a new job run uses.

**Returns:** <code><a href="#deployment">Deployment</a></code> — The newest version. Async mode returns an awaitable.

**Raises**

| Exception | When |
| --- | --- |
| [`NotAuthorized`](errors.md#notauthorized) | The caller lacks the access that this call needs. `message` says why. |
| [`NotFound`](errors.md#notfound) | The workspace has none yet. |
| [`ScopeMissing`](errors.md#scopemissing) | No workspace in scope. |

#### `Deployments.count()` {#deployments-count}

```python
count() -> int
```

Return how many versions the workspace holds.

**Returns:** <code>int</code> — The count, which saturates at 10,001. Async mode returns an awaitable.

**Raises**

| Exception | When |
| --- | --- |
| [`NotAuthorized`](errors.md#notauthorized) | The caller lacks the access that this call needs. `message` says why. |
| [`ScopeMissing`](errors.md#scopemissing) | No workspace in scope. |

#### `Deployments.list()` {#deployments-list}

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

Yield the deployments of the workspace, page by page.

**Arguments**

| Name | Type | Description |
| --- | --- | --- |
| `limit` | <code>int &#124; None</code> | The most items to return. `None` returns every item up to item 10,100, where the runtime stops paging. |
| `offset` | <code>int</code> | The number of items that the runtime skips first. |

**Returns:** <code>Iterable[<a href="#deployment">Deployment</a>] &#124; AsyncIterable[<a href="#deployment">Deployment</a>]</code> — An iterable of deployments. Async mode returns an async iterable.

**Raises**

| Exception | When |
| --- | --- |
| [`NotAuthorized`](errors.md#notauthorized) | The caller lacks the access that this call needs. `message` says why. |
| [`ScopeMissing`](errors.md#scopemissing) | No workspace in scope. |
| `ValueError` | A negative `limit` or `offset`. |

### `Deployment` {#deployment}

One uploaded version of the code of a workspace.

**Attributes**

| Name | Type | Description |
| --- | --- | --- |
| `version` | <code>int</code> | Version number within the workspace, starting at 1 and incremented by each upload. |
| `id` | <code>str</code> | Unique ID (a UUID). |
| `content_hash` | <code>str</code> | Hash 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_count` | <code>int</code> | Number of files in the package. |
| `size_bytes` | <code>int</code> | Size of the uploaded package in bytes. |
| `requirements_size_bytes` | <code>int</code> | Size of the uploaded requirements file in bytes. |
| `created_at` | <code>datetime</code> | When it was created. |
| `created_by` | <code>str</code> | The `organization_membership_id` of the member who uploaded it. |
| `updated_at` | <code>datetime</code> | When it was last changed. |

#### `Deployment.files()` {#deployment-files}

```python
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:** <code>tuple[<a href="#fileentry">FileEntry</a>, ...]</code> — One entry per file, in the order of the runtime. Async mode returns an awaitable.

**Raises**

| Exception | When |
| --- | --- |
| [`DataplaneTokenRejected`](errors.md#dataplanetokenrejected) | The data plane rejected the token that the runtime issued for it. |
| [`NotAuthorized`](errors.md#notauthorized) | The caller lacks the access that this call needs. `message` says why. |
| [`NotFound`](errors.md#notfound) | The deployment no longer exists. |
| [`ScopeMissing`](errors.md#scopemissing) | No workspace in scope. |

## Configurations

### `Configurations` {#configurations}

The configurations of one workspace.

`list()` yields the newest version first.

#### `Configurations.upload()` {#configurations-upload}

```python
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**

| Name | Type | Description |
| --- | --- | --- |
| `data` | <code>bytes &#124; BinaryIO</code> | A 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:** <code><a href="#configuration">Configuration</a></code> — The stored configuration, one version after the latest. Async mode returns an awaitable.

**Raises**

| Exception | When |
| --- | --- |
| [`BadRequest`](errors.md#badrequest) | The runtime rejected the request as invalid. `message`, `code` and `fields` say why. |
| [`Conflict`](errors.md#conflict) | The current state does not allow the call, for example an archived workspace. `code` and `message` say why. |
| [`DataplaneTokenRejected`](errors.md#dataplanetokenrejected) | The data plane rejected the token that the runtime issued for it. |
| [`InvalidResponse`](errors.md#invalidresponse) | The runtime returned an upload address that this SDK version cannot use. A newer `dlthub-client` can use it. |
| [`NotAuthorized`](errors.md#notauthorized) | The caller lacks the access that this call needs. `message` says why. |
| [`ScopeMissing`](errors.md#scopemissing) | No workspace in scope. |
| [`TransportError`](errors.md#transporterror) | The 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()` {#configurations-get}

```python
get(*, version: int) -> Configuration
```

Return one configuration by version.

**Arguments**

| Name | Type | Description |
| --- | --- | --- |
| `version` | <code>int</code> | The version to read, counting up from 1. |

**Returns:** <code><a href="#configuration">Configuration</a></code> — The configuration. Async mode returns an awaitable.

**Raises**

| Exception | When |
| --- | --- |
| [`NotAuthorized`](errors.md#notauthorized) | The caller lacks the access that this call needs. `message` says why. |
| [`NotFound`](errors.md#notfound) | The workspace has no such version. |
| [`ScopeMissing`](errors.md#scopemissing) | No workspace in scope. |

#### `Configurations.latest()` {#configurations-latest}

```python
latest() -> Configuration
```

Return the configuration that a new job run uses.

**Returns:** <code><a href="#configuration">Configuration</a></code> — The newest version. Async mode returns an awaitable.

**Raises**

| Exception | When |
| --- | --- |
| [`NotAuthorized`](errors.md#notauthorized) | The caller lacks the access that this call needs. `message` says why. |
| [`NotFound`](errors.md#notfound) | The workspace has none yet. |
| [`ScopeMissing`](errors.md#scopemissing) | No workspace in scope. |

#### `Configurations.count()` {#configurations-count}

```python
count() -> int
```

Return how many versions the workspace holds.

**Returns:** <code>int</code> — The count, which saturates at 10,001. Async mode returns an awaitable.

**Raises**

| Exception | When |
| --- | --- |
| [`NotAuthorized`](errors.md#notauthorized) | The caller lacks the access that this call needs. `message` says why. |
| [`ScopeMissing`](errors.md#scopemissing) | No workspace in scope. |

#### `Configurations.list()` {#configurations-list}

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

Yield the configurations of the workspace, page by page.

**Arguments**

| Name | Type | Description |
| --- | --- | --- |
| `limit` | <code>int &#124; None</code> | The most items to return. `None` returns every item up to item 10,100, where the runtime stops paging. |
| `offset` | <code>int</code> | The number of items that the runtime skips first. |

**Returns:** <code>Iterable[<a href="#configuration">Configuration</a>] &#124; AsyncIterable[<a href="#configuration">Configuration</a>]</code> — An iterable of configurations. Async mode returns an async iterable.

**Raises**

| Exception | When |
| --- | --- |
| [`NotAuthorized`](errors.md#notauthorized) | The caller lacks the access that this call needs. `message` says why. |
| [`ScopeMissing`](errors.md#scopemissing) | No workspace in scope. |
| `ValueError` | A negative `limit` or `offset`. |

### `Configuration` {#configuration}

One uploaded version of the configuration of a workspace.

**Attributes**

| Name | Type | Description |
| --- | --- | --- |
| `version` | <code>int</code> | Version number within the workspace, starting at 1 and incremented by each upload. |
| `id` | <code>str</code> | Unique ID (a UUID). |
| `content_hash` | <code>str</code> | Hash 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_count` | <code>int</code> | Number of files in the package. |
| `size_bytes` | <code>int</code> | Size of the uploaded package in bytes. |
| `profiles` | <code>tuple[str, ...]</code> | Profile names found in `<profile>.config.toml` / `<profile>.secrets.toml` file names, sorted. |
| `created_at` | <code>datetime</code> | When it was created. |
| `created_by` | <code>str</code> | The `organization_membership_id` of the member who uploaded it. |
| `updated_at` | <code>datetime</code> | When it was last changed. |

#### `Configuration.files()` {#configuration-files}

```python
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:** <code>tuple[<a href="#fileentry">FileEntry</a>, ...]</code> — One entry per file, in the order of the runtime. Async mode returns an awaitable.

**Raises**

| Exception | When |
| --- | --- |
| [`DataplaneTokenRejected`](errors.md#dataplanetokenrejected) | The data plane rejected the token that the runtime issued for it. |
| [`NotAuthorized`](errors.md#notauthorized) | The caller lacks the access that this call needs. `message` says why. |
| [`NotFound`](errors.md#notfound) | The configuration no longer exists. |
| [`ScopeMissing`](errors.md#scopemissing) | No workspace in scope. |

## Files

### `FileEntry` {#fileentry}

One file that the runtime holds for a deployment or a configuration.

**Attributes**

| Name | Type | Description |
| --- | --- | --- |
| `relative_path` | <code>str</code> | Path 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_bytes` | <code>int</code> | Size of the file in bytes; 0 for a symlink. |
| `sha3_256` | <code>str</code> | Base64 SHA3-256 of the file contents, or of the `linkname` string for a symlink. |
| `linkname` | <code>str &#124; None</code> | Symlink target; set for symlink entries only. |
