---
sidebar:
  label: roboto.updates
  order: 31
title: roboto.updates
---
## Module Contents

### CustomFieldChangeset

```python
class roboto.updates.CustomFieldChangeset(/, **data: Any)
```

`from roboto.updates import CustomFieldChangeset`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/updates.py#L456-L563)

Bases: `pydantic.BaseModel`

Changes to a resource's custom field values.

Pass one to an update method such as [`update()`](/docs/reference/python-sdk/roboto/domain/datasets/dataset#roboto.domain.datasets.dataset.Dataset.update). Each field it names must be a custom field the organization defines for that kind of resource, in the [`Ready`](/docs/reference/python-sdk/roboto/domain/custom_fields/record#roboto.domain.custom_fields.record.CustomFieldStatus.Ready) state, and each value must match the field's declared type. Fields the changeset does not name keep their values, and a cleared field reads back as `None`. Building a changeset that both sets and clears the same field raises `pydantic.ValidationError`.

**Parameters**

- **data** (`Any`)

**Attributes**

- **CustomFieldChangeset.clear_fields** (`StrSequence | None`) = `None`: Names of custom fields to clear.

- **CustomFieldChangeset.set_fields** (`dict[str, Any] | None`) = `None`: Custom field values to set, keyed by field name, each replacing any current value.

  Each value's Python type must match the field's [`CustomFieldType`](/docs/reference/python-sdk/roboto/domain/custom_fields/record#roboto.domain.custom_fields.record.CustomFieldType).

#### CustomFieldChangeset.Builder

```python
class Builder
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/updates.py#L484-L522)

Builder that collects custom fields to set and to clear into a `CustomFieldChangeset`.

##### CustomFieldChangeset.Builder.build()

```python
def build() -> CustomFieldChangeset
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/updates.py#L512-L522)

Return a changeset of the changes this builder collected.

**Raises**

- `pydantic.ValidationError`: The builder both sets and clears the same field.

**Returns**

- `CustomFieldChangeset`

##### CustomFieldChangeset.Builder.clear_field()

```python
def clear_field(name: str) -> CustomFieldChangeset
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/updates.py#L503-L510)

Add the name of a custom field to clear.

**Parameters**

- **name** (`str`)

**Returns**

- `CustomFieldChangeset`: This builder, so that calls can be chained.

##### CustomFieldChangeset.Builder.set_field()

```python
def set_field(name: str, value: Any) -> CustomFieldChangeset
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/updates.py#L494-L501)

Add a custom field value to set.

**Parameters**

- **name** (`str`)
- **value** (`Any`)

**Returns**

- `CustomFieldChangeset`: This builder, so that calls can be chained.

#### CustomFieldChangeset.apply_field_updates()

```python
def apply_field_updates(existing: dict[str, Any]) -> dict[str, Any]
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/updates.py#L524-L535)

Return a copy of `existing` with `set_fields` set and each field in `clear_fields` set to `None`.

**Parameters**

- **existing** (`dict[str, Any]`): Custom field values keyed by field name. Not modified.

**Returns**

- `dict[str, Any]`

#### CustomFieldChangeset.combine()

```python
def combine(other: CustomFieldChangeset) -> CustomFieldChangeset
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/updates.py#L537-L559)

Return a changeset with the effect of applying this changeset and then `other`.

Where the two set or clear the same field, `other`'s change wins.

**Parameters**

- **other** (`CustomFieldChangeset`): Changeset to apply after this one.

**Returns**

- `CustomFieldChangeset`

#### CustomFieldChangeset.is_empty()

```python
def is_empty() -> bool
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/updates.py#L561-L563)

Return whether the changeset sets and clears no fields.

**Returns**

- `bool`

### MetadataChangeset

```python
class roboto.updates.MetadataChangeset(/, **data: Any)
```

`from roboto.updates import MetadataChangeset`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/updates.py#L188-L452)

Bases: `pydantic.BaseModel`

Changes to a resource's tags and metadata.

Pass one to an update method such as [`update()`](/docs/reference/python-sdk/roboto/domain/datasets/dataset#roboto.domain.datasets.dataset.Dataset.update). Keys in `put_fields` and `remove_fields` may name a nested field in dot notation, such as `"calibration.gain"`, except on datasets, files and sessions, which apply each key as one top-level key.

**Parameters**

- **data** (`Any`)

**Attributes**

- **MetadataChangeset.put_fields** (`dict[str, Any] | None`) = `None`: Metadata fields to set, keyed by name, each replacing any current value.

- **MetadataChangeset.put_tags** (`StrSequence | None`) = `None`: Tags to add. A tag the resource already has is not added again.

- **MetadataChangeset.remove_fields** (`StrSequence | None`) = `None`: Keys of metadata fields to remove. A key the metadata lacks is ignored.

- **MetadataChangeset.remove_tags** (`StrSequence | None`) = `None`: Tags to remove. A tag the resource does not have is ignored.

- **MetadataChangeset.replace_all** (`bool`) = `False`: Whether the changeset replaces the resource's tags and metadata with `put_tags` and `put_fields`.

  When set, `remove_tags` and `remove_fields` are ignored. Datasets and files ignore `replace_all` itself and apply the rest of the changeset. `from_metadata` sets it.

#### MetadataChangeset.Builder

```python
class Builder
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/updates.py#L215-L273)

Builder that collects tags and metadata fields to put and to remove into a `MetadataChangeset`.

##### MetadataChangeset.Builder.build()

```python
def build() -> MetadataChangeset
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/updates.py#L265-L273)

Return a changeset of the changes this builder collected.

**Returns**

- `MetadataChangeset`

##### MetadataChangeset.Builder.put_field()

```python
def put_field(key: str, value: Any) -> MetadataChangeset
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/updates.py#L247-L254)

Add a metadata field to put.

**Parameters**

- **key** (`str`)
- **value** (`Any`)

**Returns**

- `MetadataChangeset`: This builder, so that calls can be chained.

##### MetadataChangeset.Builder.put_tag()

```python
def put_tag(tag: str) -> MetadataChangeset
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/updates.py#L229-L236)

Add a tag to put.

**Parameters**

- **tag** (`str`)

**Returns**

- `MetadataChangeset`: This builder, so that calls can be chained.

##### MetadataChangeset.Builder.remove_field()

```python
def remove_field(key: str) -> MetadataChangeset
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/updates.py#L256-L263)

Add the key of a metadata field to remove.

**Parameters**

- **key** (`str`)

**Returns**

- `MetadataChangeset`: This builder, so that calls can be chained.

##### MetadataChangeset.Builder.remove_tag()

```python
def remove_tag(tag: str) -> MetadataChangeset
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/updates.py#L238-L245)

Add a tag to remove.

**Parameters**

- **tag** (`str`)

**Returns**

- `MetadataChangeset`: This builder, so that calls can be chained.

#### MetadataChangeset.apply_field_updates()

```python
def apply_field_updates(existing_metadata: dict[str, Any]) -> dict[str, Any]
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/updates.py#L287-L316)

Return the metadata that results from applying this changeset to `existing_metadata`.

Sets each field in `put_fields`, then removes each key in `remove_fields`, so a key in both ends up removed. Each part of a dotted key names a key in a nested dictionary, which is created when missing, or an index when the value reached so far is a list; setting a value at a list index inserts it there. Removing a key also removes each dictionary or list the removal leaves empty, and removing a key the metadata lacks changes nothing.

**Parameters**

- **existing_metadata** (`dict[str, Any]`): Current metadata of the resource. Not modified.

**Returns**

- `dict[str, Any]`: A new dictionary of the updated metadata, or `put_fields` itself when `replace_all` is set.

**Raises**

- `IndexError`: A key in `put_fields` indexes past the end of a list before its last part.
- `ValueError`: A part of a key that reaches a list is not an integer.

#### MetadataChangeset.apply_tag_updates()

```python
def apply_tag_updates(existing_tags: list[str]) -> StrSequence
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/updates.py#L318-L338)

Return the tags that result from applying this changeset to `existing_tags`.

Appends each tag in `put_tags` that the list lacks, then removes each tag in `remove_tags`, so a tag in both ends up removed. When `replace_all` is set, returns `put_tags` itself, or an empty list.

**Parameters**

- **existing_tags** (`list[str]`): Current tags of the resource. Not modified.

**Returns**

- `StrSequence`

#### MetadataChangeset.combine()

```python
def combine(other: MetadataChangeset) -> MetadataChangeset
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/updates.py#L357-L372)

Return a changeset that holds the changes of both this changeset and `other`.

Each tag and key appears once in the result, in no fixed order. When both changesets put the same field, `other`'s value wins. The result never replaces tags or metadata, even when either changeset does: its `replace_all` is `False`.

**Parameters**

- **other** (`MetadataChangeset`): Changeset to merge with this one.

**Returns**

- `MetadataChangeset`

#### MetadataChangeset.from_metadata()

```python
@classmethod
def from_metadata(metadata: Mapping[str, Any]) -> MetadataChangeset
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/updates.py#L276-L285)

Build a changeset that replaces a resource's metadata with `metadata` and removes all of its tags.

On datasets and files, which ignore `replace_all`, it merges `metadata` into the existing metadata instead and keeps the tags.

**Parameters**

- **metadata** (`Mapping[str, Any]`): Metadata the resource has after the update.

**Returns**

- `MetadataChangeset`

#### MetadataChangeset.is_empty()

```python
def is_empty() -> bool
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/updates.py#L374-L383)

Return whether the changeset has no tags or fields to put or remove, and does not replace them.

**Returns**

- `bool`

### StrSequence

```python
roboto.updates.StrSequence
```

`from roboto.updates import StrSequence`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/updates.py#L15-L15)

Strings given as a list, tuple, or set.

### TaglessMetadataChangeset

```python
class roboto.updates.TaglessMetadataChangeset(/, **data: Any)
```

`from roboto.updates import TaglessMetadataChangeset`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/updates.py#L19-L185)

Bases: `pydantic.BaseModel`

Changes to the metadata of a resource that has no tags, such as a topic's message path.

Pass one to [`update_message_path()`](/docs/reference/python-sdk/roboto/domain/topics/topic#roboto.domain.topics.topic.Topic.update_message_path).

**Parameters**

- **data** (`Any`)

**Attributes**

- **TaglessMetadataChangeset.put_fields** (`dict[str, Any] | None`) = `None`: Metadata fields to set, keyed by name, each replacing any current value.

  A key in dot notation, such as `"calibration.gain"`, names a nested field.

- **TaglessMetadataChangeset.remove_fields** (`StrSequence | None`) = `None`: Keys of metadata fields to remove, in the same dot notation. A key the metadata lacks is ignored.

- **TaglessMetadataChangeset.replace_all** (`bool`) = `False`: Whether the changeset replaces all metadata with `put_fields`, ignoring `remove_fields`.

  `from_replacement_metadata` sets it.

#### TaglessMetadataChangeset.Builder

```python
class Builder
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/updates.py#L40-L74)

Builder that collects metadata fields to put and to remove into a `TaglessMetadataChangeset`.

##### TaglessMetadataChangeset.Builder.build()

```python
def build() -> TaglessMetadataChangeset
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/updates.py#L68-L74)

Return a changeset of the changes this builder collected.

**Returns**

- `TaglessMetadataChangeset`

##### TaglessMetadataChangeset.Builder.put_field()

```python
def put_field(key: str, value: Any) -> TaglessMetadataChangeset
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/updates.py#L50-L57)

Add a metadata field to put.

**Parameters**

- **key** (`str`)
- **value** (`Any`)

**Returns**

- `TaglessMetadataChangeset`: This builder, so that calls can be chained.

##### TaglessMetadataChangeset.Builder.remove_field()

```python
def remove_field(key: str) -> TaglessMetadataChangeset
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/updates.py#L59-L66)

Add the key of a metadata field to remove.

**Parameters**

- **key** (`str`)

**Returns**

- `TaglessMetadataChangeset`: This builder, so that calls can be chained.

#### TaglessMetadataChangeset.apply_field_updates()

```python
def apply_field_updates(existing_metadata: dict[str, Any]) -> dict[str, Any]
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/updates.py#L86-L111)

Return the metadata that results from applying this changeset to `existing_metadata`.

Behaves as `MetadataChangeset.apply_field_updates` does.

**Parameters**

- **existing_metadata** (`dict[str, Any]`): Current metadata of the resource. Not modified.

**Returns**

- `dict[str, Any]`: A new dictionary of the updated metadata, or `put_fields` itself when `replace_all` is set.

**Raises**

- `IndexError`: A key in `put_fields` indexes past the end of a list before its last part.
- `ValueError`: A part of a key that reaches a list is not an integer.

#### TaglessMetadataChangeset.from_replacement_metadata()

```python
@classmethod
def from_replacement_metadata(metadata: dict[str, Any]) -> TaglessMetadataChangeset
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/updates.py#L77-L84)

Build a changeset that replaces all of a resource's metadata with `metadata`.

**Parameters**

- **metadata** (`dict[str, Any]`): Metadata the resource has after the update.

**Returns**

- `TaglessMetadataChangeset`

#### TaglessMetadataChangeset.has_changes()

```python
def has_changes() -> bool
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/updates.py#L113-L116)

Return whether the changeset has fields to put or remove, or replaces the metadata.

**Returns**

- `bool`

### UpdateCondition

```python
class roboto.updates.UpdateCondition(/, **data: Any)
```

`from roboto.updates import UpdateCondition`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/updates.py#L566-L581)

Bases: `pydantic.BaseModel`

Condition on a resource's current value that an update must meet to succeed.

The update succeeds only when the current value of `key` compares to `value` as `comparator` requires. Building one with a `comparator` other than `"eq"` or `"ne"` raises `pydantic.ValidationError`. No SDK method or Roboto route uses this model.

**Parameters**

- **data** (`Any`)

**Attributes**

- **UpdateCondition.comparator** (`Literal['eq', 'ne']`): How the two values must compare: `"eq"` requires them to be equal, `"ne"` requires them to differ.
- **UpdateCondition.key** (`str`): Name of the resource's field to compare.
- **UpdateCondition.value** (`Any`) = `None`: Value to compare the field's current value with.
