---
sidebar:
  hidden: true
title: roboto.domain.collections.record
---
## Module Contents

### CollectionChangeRecord

```python
class roboto.domain.collections.record.CollectionChangeRecord(/, **data: Any)
```

`from roboto import CollectionChangeRecord`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/collections/record.py#L182-L204)

Bases: `pydantic.BaseModel`

Data record of one update to a collection, as the Roboto API returns it.

[`changes()`](/docs/reference/python-sdk/roboto/domain/collections/collection#roboto.domain.collections.collection.Collection.changes) yields these, oldest first.

**Parameters**

- **data** (`Any`)

**Attributes**

- **CollectionChangeRecord.applied** (`datetime.datetime`): Time the update was applied.
- **CollectionChangeRecord.applied_by** (`str`): ID of the user who made the update.
- **CollectionChangeRecord.change_set** (`CollectionChangeSet`): What the update changed.
- **CollectionChangeRecord.collection_id** (`str`): ID of the collection the update changed.
- **CollectionChangeRecord.from_version** (`int`): Version of the collection before the update.
- **CollectionChangeRecord.to_version** (`int`): Version of the collection the update produced, one higher than `from_version`.

### CollectionChangeSet

```python
class roboto.domain.collections.record.CollectionChangeSet(/, **data: Any)
```

`from roboto import CollectionChangeSet`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/collections/record.py#L157-L179)

Bases: `pydantic.BaseModel`

Changes that one update made to a collection.

Carried in `CollectionChangeRecord.change_set`.

**Parameters**

- **data** (`Any`)

**Attributes**

- **CollectionChangeSet.added_resources** (`list[CollectionResourceRef]`) = `None`: Resources the update added, as the caller gave them, including any that were already members.

- **CollectionChangeSet.added_tags** (`list[str]`) = `None`: Tags the update added.

- **CollectionChangeSet.field_changes** (`dict[str, Any]`) = `None`: New values of the `name` and `description` the update set, keyed by field name.

  Holds only the fields the update set. Changes to custom fields are not recorded.

- **CollectionChangeSet.removed_resources** (`list[CollectionResourceRef]`) = `None`: Resources the update removed, as the caller gave them, including any that were not members.

- **CollectionChangeSet.removed_tags** (`list[str]`) = `None`: Tags the update removed.

### CollectionContentMode

```python
class roboto.domain.collections.record.CollectionContentMode
```

`from roboto import CollectionContentMode`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/collections/record.py#L25-L46)

Bases: `roboto.compat.StrEnum`

Amount of detail about a collection's members that a read of the collection returns.

**Attributes**

- **CollectionContentMode.Full** = `'full'`: Each member's full record.

  Lists the members Roboto cannot return in `CollectionRecord.missing`. Fetching one collection in this mode fails with `RobotoInvalidRequestException` when the response would be too large; read it with `References` instead.

- **CollectionContentMode.References** = `'references'`: A `CollectionResourceRef` for each member.

  Leaves out the events the caller cannot read.

- **CollectionContentMode.SummaryOnly** = `'summary_only'`: The collection's fields without its members.

  Leaves `CollectionRecord.resources` empty.

### CollectionRecord

```python
class roboto.domain.collections.record.CollectionRecord(/, **data: Any)
```

`from roboto import CollectionRecord`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/collections/record.py#L66-L154)

Bases: `pydantic.BaseModel`

Data record of a collection, as the Roboto API returns it.

A collection is a versioned container that groups resources of one type: datasets, files, events, or sessions. [`Collection`](/docs/reference/python-sdk/roboto/domain/collections/collection#roboto.domain.collections.collection.Collection) wraps this record with methods that act on the collection, and exposes it as [`record`](/docs/reference/python-sdk/roboto/domain/collections/collection#roboto.domain.collections.collection.Collection.record).

**Parameters**

- **data** (`Any`)

**Attributes**

- **CollectionRecord.collection_id** (`str`): Unique ID of the collection, beginning with `cl_`.

- **CollectionRecord.created** (`datetime.datetime`): Time the collection was created.

- **CollectionRecord.created_by** (`str`): ID of the user who created the collection.

- **CollectionRecord.custom_fields** (`dict[str, Any]`) = `None`: Values of the custom fields the organization defines for collections, keyed by field name.

  Every collection custom field in the [`Ready`](/docs/reference/python-sdk/roboto/domain/custom_fields/record#roboto.domain.custom_fields.record.CustomFieldStatus.Ready) state appears as a key, mapped to `None` when the collection has no value for it. Fields in any other state are absent, so the map is empty when no collection custom field is in that state.

- **CollectionRecord.description** (`str | None`) = `None`: Human-readable description of the collection, or `None` if it has none.

- **CollectionRecord.missing** (`dict[CollectionResourceType, list[CollectionResourceRef]]`) = `None`: Members a `CollectionContentMode.Full` read does not show.

  Keyed by resource type. These are the members that no longer exist, the datasets, events and sessions in another organization, and the datasets, files and events the caller cannot read. Empty in the other content modes.

- **CollectionRecord.name** (`str | None`) = `None`: Human-readable name of the collection, or `None` if it has none. Roboto does not require names to be unique.

- **CollectionRecord.org_id** (`str`): ID of the organization that owns the collection.

- **CollectionRecord.resource_count** (`int`) = `0`: Number of members the collection holds, in every content mode.

  Set in `CollectionContentMode.SummaryOnly` reads too. Counts the members that `missing` lists or that a `CollectionContentMode.References` read leaves out, so it can be higher than the number of entries in `resources`.

- **CollectionRecord.resource_type** (`CollectionResourceType`): Type of resource the collection holds.

  Fixed when the collection is created. Roboto rejects adding a resource of any other type with `RobotoInvalidRequestException`.

- **CollectionRecord.resources** (`dict[CollectionResourceType, list[Any]]`) = `None`: Members of the collection, keyed by resource type.

  What each entry holds depends on the `CollectionContentMode` the collection was read with:

  - `Full`: a dictionary of the member's record, such as a [`DatasetRecord`](/docs/reference/python-sdk/roboto/domain/datasets/record#roboto.domain.datasets.record.DatasetRecord).
  - `References`: a dictionary of a `CollectionResourceRef`.
  - `SummaryOnly`: nothing; the map is empty.

  [`datasets`](/docs/reference/python-sdk/roboto/domain/collections/collection#roboto.domain.collections.collection.Collection.datasets), [`events`](/docs/reference/python-sdk/roboto/domain/collections/collection#roboto.domain.collections.collection.Collection.events), [`files`](/docs/reference/python-sdk/roboto/domain/collections/collection#roboto.domain.collections.collection.Collection.files) and [`sessions`](/docs/reference/python-sdk/roboto/domain/collections/collection#roboto.domain.collections.collection.Collection.sessions) return the members' IDs from either form.

- **CollectionRecord.tags** (`list[str]`) = `[]`: Tags on the collection.

- **CollectionRecord.updated** (`datetime.datetime`): Time the collection was last updated, or the time it was created if it has never been updated.

- **CollectionRecord.updated_by** (`str`): ID of the user who last updated the collection, or who created it if it has never been updated.

- **CollectionRecord.version** (`int`): Version of the collection: `0` when it is created, and one higher after each update.

  Roboto sets it; no request does. [`changes()`](/docs/reference/python-sdk/roboto/domain/collections/collection#roboto.domain.collections.collection.Collection.changes) yields a `CollectionChangeRecord` for each update.

### CollectionResourceRef

```python
class roboto.domain.collections.record.CollectionResourceRef(/, **data: Any)
```

`from roboto import CollectionResourceRef`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/collections/record.py#L49-L63)

Bases: `pydantic.BaseModel`

Reference to one member of a collection, by its type and ID.

**Parameters**

- **data** (`Any`)

**Attributes**

- **CollectionResourceRef.resource_id** (`str`): ID of the resource, such as `ds_12345` for a dataset.

- **CollectionResourceRef.resource_type** (`CollectionResourceType`): Type of the resource. Roboto rejects adding a resource whose type differs from the collection's.

- **CollectionResourceRef.resource_version** (`str | None`) = `None`: Version of the resource the caller gave when adding the reference, or `None` if none was given.

  Roboto stores it with the reference, but a `CollectionContentMode.Full` read returns each member as it is now, whatever this value.

### CollectionResourceType

```python
class roboto.domain.collections.record.CollectionResourceType
```

`from roboto import CollectionResourceType`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/collections/record.py#L16-L22)

Bases: `roboto.compat.StrEnum`

Type of resource a collection holds.

**Attributes**

- **CollectionResourceType.Dataset** = `'dataset'`
- **CollectionResourceType.Event** = `'event'`
- **CollectionResourceType.File** = `'file'`
- **CollectionResourceType.Session** = `'session'`
