---
sidebar:
  hidden: true
title: roboto.domain.datasets.dataset
---
## Module Contents

### Dataset

```python
class roboto.domain.datasets.dataset.Dataset(
    record: roboto.domain.datasets.record.DatasetRecord,
    roboto_client: Optional[roboto.http.RobotoClient] = None,
    file_service: Optional[roboto.storage.FileService] = None,
    content_mode: Optional[roboto.query.QueryContentMode] = None,
)
```

`from roboto import Dataset`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/datasets/dataset.py#L61-L1502)

A dataset: a container of files in a directory structure, usually from one robot activity such as a flight.

A dataset belongs to one organization and can name the device its data came from. Its files are [`File`](/docs/reference/python-sdk/roboto/domain/files/file#roboto.domain.files.file.File) objects, reached through `files` or the file methods on this class. Ingestion extracts topics from those files, which `get_topics` lists. A session can include files from one or more datasets. A dataset also carries tags, key-value metadata, custom-field values, and an optional AI summary.

Get a `Dataset` from `create`, `create_if_not_exists`, `from_id`, or `query`. To wrap a [`DatasetRecord`](/docs/reference/python-sdk/roboto/domain/datasets/record#roboto.domain.datasets.record.DatasetRecord) already fetched from Roboto, build a `Dataset` from it directly. Each instance holds a copy of the dataset's record: methods that change the dataset's properties update that copy from Roboto's response, and `refresh` fetches changes made elsewhere.

**Parameters**

- **record** (`roboto.domain.datasets.record.DatasetRecord`): Record of the dataset.
- **roboto_client** (`Optional[roboto.http.RobotoClient]`): Client to make requests to Roboto with. Defaults to one configured from the environment, by [`from_env()`](/docs/reference/python-sdk/roboto/http/roboto_client#roboto.http.roboto_client.RobotoClient.from_env).
- **file_service** (`Optional[roboto.storage.FileService]`): Transfers file contents to and from storage. Built from `roboto_client` if omitted.
- **content_mode** (`Optional[roboto.query.QueryContentMode]`): Whether `record` includes the dataset's metadata. [`RecordOnly`](/docs/reference/python-sdk/roboto/query/api#roboto.query.api.QueryContentMode.RecordOnly) makes the first `get_metadata` call fetch the full record. `None` means `record` includes it.

**Properties**

- **Dataset.created** (`datetime.datetime`): Time the dataset was created.

- **Dataset.created_by** (`str`): Principal that created the dataset, as `<type>:<id>`, such as `user:<user_id>`.

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

  [`custom_fields`](/docs/reference/python-sdk/roboto/domain/datasets/record#roboto.domain.datasets.record.DatasetRecord.custom_fields) says which fields appear as keys. A [`Timestamp`](/docs/reference/python-sdk/roboto/domain/custom_fields/record#roboto.domain.custom_fields.record.CustomFieldType.Timestamp) value is an ISO 8601 string.

- **Dataset.dataset_id** (`str`): Unique ID of the dataset, beginning with `ds_`.

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

  Return type: `Optional[str]`

- **Dataset.device_id** (`str | None`): ID of the device the dataset's data came from, or `None` if none was given.

  Return type: `Optional[str]`

- **Dataset.files** (`roboto.domain.files.FileSystem`): Files and directories of the dataset.

  The file methods on `Dataset` call the same methods on this object, so `dataset.upload_files(...)` and `dataset.files.upload_files(...)` are the same call.

- **Dataset.metadata** (`dict[str, Any]`): Copy of the key-value metadata on the dataset.

  Reading it can make a request, as `get_metadata` describes. Prefer that method, which returns the same value and shows the request at the call site.

- **Dataset.modified** (`datetime.datetime`): Time the dataset was last modified.

- **Dataset.modified_by** (`str`): Principal that last modified the dataset, in the same `<type>:<id>` form as `created_by`.

- **Dataset.name** (`str | None`): Human-readable name of the dataset, at most 120 characters, or `None` if it has none.

  [`name`](/docs/reference/python-sdk/roboto/domain/datasets/record#roboto.domain.datasets.record.DatasetRecord.name) says whether names must be unique.

  Return type: `Optional[str]`

- **Dataset.org_id** (`str`): ID of the organization that owns the dataset.

- **Dataset.record** (`roboto.domain.datasets.record.DatasetRecord`): Record of the dataset that this instance holds.

  `refresh` replaces it with the current one.

- **Dataset.tags** (`list[str]`): Copy of the tags on the dataset.

#### Dataset.clear_custom_field()

```python
def clear_custom_field(name: str) -> Dataset
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/datasets/dataset.py#L1133-L1149)

Clear one custom-field value on the dataset, so the field reads back as `None`.

It calls `update`, whose failures also apply.

**Parameters**

- **name** (`str`): Name of a ready custom field defined for datasets in the dataset's organization.

**Returns**

- `Dataset`: This instance, with its record updated from Roboto's response.

**Usage**

```python
dataset = Dataset.from_id("ds_abc123")
dataset.clear_custom_field("flight_count").custom_fields["flight_count"] is None
# True
```

#### Dataset.clear_custom_fields()

```python
def clear_custom_fields(names: collections.abc.Sequence[str]) -> Dataset
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/datasets/dataset.py#L1172-L1187)

Clear several custom-field values on the dataset, so each field reads back as `None`.

It calls `update`, whose failures also apply.

**Parameters**

- **names** (`collections.abc.Sequence[str]`): Names of ready custom fields defined for datasets in the dataset's organization.

**Returns**

- `Dataset`: This instance, with its record updated from Roboto's response.

**Usage**

```python
dataset = Dataset.from_id("ds_abc123")
dataset.clear_custom_fields(["drone_id", "flight_count"])
```

#### Dataset.create()

```python
@classmethod
def create(
    description: Optional[str] = None,
    metadata: Optional[dict[str, Any]] = None,
    name: Optional[str] = None,
    tags: Optional[list[str]] = None,
    device_id: Optional[str] = None,
    custom_fields: Optional[dict[str, Any]] = None,
    caller_org_id: Optional[str] = None,
    roboto_client: Optional[roboto.http.RobotoClient] = None,
    create_device_if_missing: bool = False,
) -> Dataset
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/datasets/dataset.py#L91-L176)

Create a dataset.

**Parameters**

- **description** (`Optional[str]`): Human-readable description of the dataset.
- **metadata** (`Optional[dict[str, Any]]`): Key-value metadata to set on the dataset. `None` sets none.
- **name** (`Optional[str]`): Human-readable name of the dataset, at most 120 characters. Roboto does not require names to be unique.
- **tags** (`Optional[list[str]]`): Tags to set on the dataset. `None` sets none.
- **device_id** (`Optional[str]`): ID of the device that produced the dataset's data. `None` records the calling device when a device makes the request, and no device otherwise.
- **custom_fields** (`Optional[dict[str, Any]]`): Initial values for the dataset's custom fields, keyed by field name. Each name must be a custom field defined for datasets in the organization, with status [`Ready`](/docs/reference/python-sdk/roboto/domain/custom_fields/record#roboto.domain.custom_fields.record.CustomFieldStatus.Ready), and each value must match that field's declared type. `None` sets none.
- **caller_org_id** (`Optional[str]`): Organization to create the dataset in. Required when the caller belongs to more than one organization; otherwise the caller's only organization.
- **roboto_client** (`Optional[roboto.http.RobotoClient]`): Client to make requests to Roboto with. Defaults to one configured from the environment, by [`from_env()`](/docs/reference/python-sdk/roboto/http/roboto_client#roboto.http.roboto_client.RobotoClient.from_env).
- **create_device_if_missing** (`bool`): Whether to create the device named by `device_id` when the organization has no such device, then create the dataset again. When `False`, a missing device raises [`RobotoDeviceNotFoundException`](/docs/reference/python-sdk/roboto/exceptions/domain#roboto.exceptions.domain.RobotoDeviceNotFoundException).

**Returns**

- `Dataset`: The new dataset.

**Raises**

- [`RobotoDeviceNotFoundException`](/docs/reference/python-sdk/roboto/exceptions/domain#roboto.exceptions.domain.RobotoDeviceNotFoundException): `device_id` names no device in the organization, and `create_device_if_missing` is `False`.
- [`RobotoIllegalArgumentException`](/docs/reference/python-sdk/roboto/exceptions/domain#roboto.exceptions.domain.RobotoIllegalArgumentException): A `custom_fields` name is not a ready custom field for datasets, or its value does not match the field's type.

**Usage**

Create a dataset with a name, tags, and metadata:

```python
dataset = Dataset.create(
    name="Highway Test Session",
    description="Autonomous vehicle highway driving test data",
    tags=["highway", "autonomous", "test"],
    metadata={"vehicle_id": "vehicle_001", "test_type": "highway"},
)
```

Create an empty dataset with no properties set:

```python
dataset = Dataset.create()
print(dataset.dataset_id)
```

#### Dataset.create_directory()

```python
def create_directory(
    name: str,
    error_if_exists: bool = False,
    create_intermediate_dirs: bool = False,
    parent_path: Optional[pathlib.Path] = None,
    origination: Optional[str] = None,
) -> roboto.domain.files.DirectoryRecord
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/datasets/dataset.py#L516-L566)

Create a directory in the dataset.

It calls [`create_directory()`](/docs/reference/python-sdk/roboto/domain/files/file_system#roboto.domain.files.file_system.FileSystem.create_directory), whose failures also apply.

**Parameters**

- **name** (`str`): Name of the directory to create.
- **error_if_exists** (`bool`): Whether to raise when the directory already exists.
- **create_intermediate_dirs** (`bool`): Whether to create missing directories in `parent_path`. When `False`, every directory in `parent_path` must already exist.
- **parent_path** (`Optional[pathlib.Path]`): Path of the parent directory, relative to the dataset's root. `None` creates the directory at the root.
- **origination** (`Optional[str]`): Free-form description of what created the directory. `None` records the `ROBOTO_ENV` environment variable if set, and otherwise `roboto` followed by the SDK version.

**Returns**

- `roboto.domain.files.DirectoryRecord`: Record of the created directory.

**Usage**

Create a directory at the dataset's root:

```python
import pathlib
dataset = Dataset.from_id("ds_abc123")
directory = dataset.create_directory("foo")
print(directory.relative_path)
# foo
```

Create a directory and any missing directories above it:

```python
directory = dataset.create_directory(
    name="final",
    parent_path=pathlib.Path("path/to/deep"),
    create_intermediate_dirs=True,
)
print(directory.relative_path)
# path/to/deep/final
```

#### Dataset.create_if_not_exists()

```python
@classmethod
def create_if_not_exists(
    match_roboql_query: str,
    description: Optional[str] = None,
    metadata: Optional[dict[str, Any]] = None,
    name: Optional[str] = None,
    tags: Optional[list[str]] = None,
    device_id: Optional[str] = None,
    custom_fields: Optional[dict[str, Any]] = None,
    caller_org_id: Optional[str] = None,
    roboto_client: Optional[roboto.http.RobotoClient] = None,
    create_device_if_missing: bool = False,
) -> Dataset
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/datasets/dataset.py#L179-L288)

Fetch the first dataset that matches a RoboQL query, creating one when none matches.

A matching dataset is returned unchanged: the other arguments apply only to a dataset this call creates.

Concurrent calls with the same `match_roboql_query` in one organization create one dataset between them, because Roboto runs them one at a time from the search through the create. Calls with different queries are not run one at a time, even when both queries would match the same dataset.

The dataset created must match `match_roboql_query`. If `name`, `tags` or `metadata` describe a dataset the query does not match, every later call creates another one. When several datasets match, which one is returned is not defined unless the query ends with a `SORT BY` clause.

**Parameters**

- **match_roboql_query** (`str`): RoboQL query that looks for an existing dataset in the organization.
- **description** (`Optional[str]`): Human-readable description of the dataset.
- **metadata** (`Optional[dict[str, Any]]`): Key-value metadata to set on the dataset. `None` sets none.
- **name** (`Optional[str]`): Human-readable name of the dataset, at most 120 characters.
- **tags** (`Optional[list[str]]`): Tags to set on the dataset. `None` sets none.
- **device_id** (`Optional[str]`): ID of the device that produced the dataset's data. `None` records the calling device when a device makes the request, and no device otherwise.
- **custom_fields** (`Optional[dict[str, Any]]`): Initial values for the dataset's custom fields, keyed by field name. Each name must be a custom field defined for datasets in the organization, with status [`Ready`](/docs/reference/python-sdk/roboto/domain/custom_fields/record#roboto.domain.custom_fields.record.CustomFieldStatus.Ready), and each value must match that field's declared type. `None` sets none.
- **caller_org_id** (`Optional[str]`): Organization to search and to create the dataset in. Required when the caller belongs to more than one organization; otherwise the caller's only organization.
- **roboto_client** (`Optional[roboto.http.RobotoClient]`): Client to make requests to Roboto with. Defaults to one configured from the environment, by [`from_env()`](/docs/reference/python-sdk/roboto/http/roboto_client#roboto.http.roboto_client.RobotoClient.from_env).
- **create_device_if_missing** (`bool`): Whether to create the device named by `device_id` when the organization has no such device, then make the call again. When `False`, a missing device raises [`RobotoDeviceNotFoundException`](/docs/reference/python-sdk/roboto/exceptions/domain#roboto.exceptions.domain.RobotoDeviceNotFoundException).

**Returns**

- `Dataset`: The matching dataset, or the new dataset when none matched.

**Raises**

- [`RobotoDeviceNotFoundException`](/docs/reference/python-sdk/roboto/exceptions/domain#roboto.exceptions.domain.RobotoDeviceNotFoundException): No dataset matched, `device_id` names no device in the organization, and `create_device_if_missing` is `False`.
- [`RobotoIllegalArgumentException`](/docs/reference/python-sdk/roboto/exceptions/domain#roboto.exceptions.domain.RobotoIllegalArgumentException): No dataset matched, and a `custom_fields` name is not a ready custom field for datasets, or its value does not match the field's type.
- [`RobotoInvalidRequestException`](/docs/reference/python-sdk/roboto/exceptions/domain#roboto.exceptions.domain.RobotoInvalidRequestException): `match_roboql_query` is not a valid RoboQL query.

**Usage**

Create a dataset unless one with this metadata value exists:

```python
dataset = Dataset.create_if_not_exists(
    match_roboql_query="dataset.metadata.vehicle_id = 'vehicle_001'",
    name="Vehicle 001 Test Session",
    description="Test data for vehicle 001",
    metadata={"vehicle_id": "vehicle_001", "test_type": "highway"},
    tags=["vehicle_001", "highway"],
)
```

Create a dataset unless one with this tag exists. The new dataset carries the tag, so later calls return it:

```python
dataset = Dataset.create_if_not_exists(
    match_roboql_query="dataset.tags CONTAINS 'unique_session_id_xyz'",
    name="Unique Test Session",
    tags=["unique_session_id_xyz", "test"],
)
```

#### Dataset.create_session()

```python
def create_session(
    name: Optional[str] = None,
    *,
    device_ids: Optional[collections.abc.Sequence[str]] = None,
    include_patterns: Optional[list[str]] = None,
    exclude_patterns: Optional[list[str]] = None,
    description: Optional[str] = None,
    metadata: Optional[dict[str, Any]] = None,
    tags: Optional[collections.abc.Sequence[str]] = None,
    custom_fields: Optional[dict[str, Any]] = None,
) -> roboto.experimental.sessions.Session
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/datasets/dataset.py#L569-L658)

Create a session in the dataset's organization that includes the dataset's files.

A session is an operational time window of a device. The new session includes every file of the dataset that `include_patterns` and `exclude_patterns` select, each over its whole time range.

**Parameters**

- **name** (`Optional[str]`): Human-readable name of the session, at most 120 characters.
- **device_ids** (`Optional[collections.abc.Sequence[str]]`): IDs of the devices to attach to the session. `None` attaches none.
- **include_patterns** (`Optional[list[str]]`): Gitignore-style patterns for the files to include, as in `list_files`. `None` or an empty list includes every file.
- **exclude_patterns** (`Optional[list[str]]`): Gitignore-style patterns for the files to leave out. Takes precedence over `include_patterns`.
- **description** (`Optional[str]`): Human-readable description of the session.
- **metadata** (`Optional[dict[str, Any]]`): Key-value metadata to set on the session. Sessions cannot be filtered or sorted by metadata keys; for a queryable attribute, define a custom field for sessions instead.
- **tags** (`Optional[collections.abc.Sequence[str]]`): Tags to set on the session. Sessions can be filtered by tag but not sorted by tag.
- **custom_fields** (`Optional[dict[str, Any]]`): Initial values for the session's custom fields, keyed by field name. Each name must be a custom field defined for sessions in the dataset's organization, with status [`Ready`](/docs/reference/python-sdk/roboto/domain/custom_fields/record#roboto.domain.custom_fields.record.CustomFieldStatus.Ready), and each value must match that field's declared type.

**Returns**

- `roboto.experimental.sessions.Session`: The new [`Session`](/docs/reference/python-sdk/roboto/experimental/sessions/session#roboto.experimental.sessions.session.Session).

**Raises**

- [`RobotoDomainException`](/docs/reference/python-sdk/roboto/exceptions/domain#roboto.exceptions.domain.RobotoDomainException): Roboto refused a file, or a request failed. Unless the session could not be deleted (see the note below), no session is left behind, so calling again is safe.

> **Note**
>
> This method calls [`create()`](/docs/reference/python-sdk/roboto/experimental/sessions/session#roboto.experimental.sessions.session.Session.create), then [`add_files()`](/docs/reference/python-sdk/roboto/experimental/sessions/session#roboto.experimental.sessions.session.Session.add_files) once per batch of at most 500 files ([`MAX_FILES_AND_TOPICS_PER_REQUEST`](/docs/reference/python-sdk/roboto/experimental/ingest/operations#roboto.experimental.ingest.operations.MAX_FILES_AND_TOPICS_PER_REQUEST)). Every file goes in or none does: when any batch fails or Roboto refuses any file, the session is deleted before the exception propagates. If deleting it fails too, such as on a network error, the session is left holding the files added so far; that failure is logged, and the caller sees the original exception.

**Usage**

Include every file of the dataset:

```python
dataset = Dataset.from_id("ds_abc123")
session = dataset.create_session("flight-2026-04-23-001")
```

Include only the dataset's MCAP files:

```python
session = dataset.create_session("flight-2026-04-23-002", include_patterns=["**/*.mcap"])
```

#### Dataset.delete()

```python
def delete() -> None
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/datasets/dataset.py#L660-L674)

Delete the dataset, with its files and their topics. This cannot be undone.

Files uploaded through Roboto are also deleted from storage, whether they are stored in a Roboto-managed bucket or in a bucket the organization provides. Files imported from such a bucket with [`import_batch()`](/docs/reference/python-sdk/roboto/domain/files/file#roboto.domain.files.file.File.import_batch) stay in the bucket; only their records are deleted from Roboto.

Deleting a dataset that no longer exists succeeds and changes nothing.

**Usage**

```python
dataset = Dataset.from_id("ds_abc123")
dataset.delete()
```

**Returns**

- `None`

#### Dataset.delete_files()

```python
def delete_files(
    include_patterns: Optional[list[str]] = None,
    exclude_patterns: Optional[list[str]] = None,
) -> None
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/datasets/dataset.py#L676-L705)

Delete the dataset's files that match the given patterns.

Deletes the matching files one request per file, so when one request fails, the files deleted before it stay deleted. It calls [`delete_files()`](/docs/reference/python-sdk/roboto/domain/files/file_system#roboto.domain.files.file_system.FileSystem.delete_files), whose failures also apply.

**Parameters**

- **include_patterns** (`Optional[list[str]]`): Gitignore-style patterns for the files to delete. `None` or an empty list selects every file.
- **exclude_patterns** (`Optional[list[str]]`): Gitignore-style patterns for files to keep. Takes precedence over `include_patterns`. `None` or an empty list keeps none.

**Returns**

- `None`

> **Note**
>
> Patterns follow the gitignore format described at [https://git-scm.com/docs/gitignore](https://git-scm.com/docs/gitignore).

**Usage**

Delete every PNG file except those under a `back_camera` directory:

```python
dataset = Dataset.from_id("ds_abc123")
dataset.delete_files(include_patterns=["**/*.png"], exclude_patterns=["**/back_camera/**"])
```

Delete every log file:

```python
dataset.delete_files(include_patterns=["**/*.log"])
```

#### Dataset.download_files()

```python
def download_files(
    out_path: pathlib.Path,
    include_patterns: Optional[list[str]] = None,
    exclude_patterns: Optional[list[str]] = None,
    print_progress: bool = True,
) -> list[tuple[roboto.domain.files.FileRecord, pathlib.Path]]
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/datasets/dataset.py#L707-L749)

Download the dataset's files that match the given patterns to a local directory.

Each file is saved at its path relative to the dataset's root, under `out_path`. It calls [`download_files()`](/docs/reference/python-sdk/roboto/domain/files/file_system#roboto.domain.files.file_system.FileSystem.download_files), whose failures also apply.

**Parameters**

- **out_path** (`pathlib.Path`): Local directory to download into. Created, with any missing parents, if it does not exist.
- **include_patterns** (`Optional[list[str]]`): Gitignore-style patterns for the files to download. `None` or an empty list selects every file.
- **exclude_patterns** (`Optional[list[str]]`): Gitignore-style patterns for files to skip. Takes precedence over `include_patterns`. `None` or an empty list skips none.
- **print_progress** (`bool`): Whether to show a progress bar during the download.

**Returns**

- `list[tuple[roboto.domain.files.FileRecord, pathlib.Path]]`: One `(record, local_path)` pair per downloaded file.

> **Note**
>
> Patterns follow the gitignore format described at [https://git-scm.com/docs/gitignore](https://git-scm.com/docs/gitignore).

**Usage**

Download the dataset's bag files, except those under a `test` directory:

```python
import pathlib
dataset = Dataset.from_id("ds_abc123")
downloaded = dataset.download_files(
    pathlib.Path("/tmp/dataset_download"),
    include_patterns=["**/*.bag"],
    exclude_patterns=["**/test/**"],
)
print(f"Downloaded {len(downloaded)} files")
```

Download every file:

```python
all_files = dataset.download_files(pathlib.Path("/tmp/all_files"))
```

#### Dataset.from_id()

```python
@classmethod
def from_id(
    dataset_id: str,
    roboto_client: Optional[roboto.http.RobotoClient] = None,
) -> Dataset
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/datasets/dataset.py#L291-L308)

Fetch a dataset by its ID.

**Parameters**

- **dataset_id** (`str`): Unique ID of the dataset, beginning with `ds_`.
- **roboto_client** (`Optional[roboto.http.RobotoClient]`): Client to make requests to Roboto with. Defaults to one configured from the environment, by [`from_env()`](/docs/reference/python-sdk/roboto/http/roboto_client#roboto.http.roboto_client.RobotoClient.from_env).

**Raises**

- [`RobotoDatasetNotFoundException`](/docs/reference/python-sdk/roboto/exceptions/domain#roboto.exceptions.domain.RobotoDatasetNotFoundException): No dataset has this ID.

**Returns**

- `Dataset`

**Usage**

```python
dataset = Dataset.from_id("ds_abc123")
print(dataset.name)
```

#### Dataset.generate_summary()

```python
def generate_summary() -> roboto.ai.summary.StreamingAISummary
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/datasets/dataset.py#L779-L815)

Start generating a new AI summary of the dataset.

Roboto generates the summary in the background. This method returns once generation has started; the returned object fetches the rest of the summary from Roboto when you wait for it or stream its text.

**Returns**

- `roboto.ai.summary.StreamingAISummary`: The summary being generated, which starts in the [`Pending`](/docs/reference/python-sdk/roboto/ai/summary#roboto.ai.summary.AISummaryStatus.Pending) state.

**Usage**

Generate a summary and wait for its full text:

```python
dataset = Dataset.from_id("ds_abc123")
summary = dataset.generate_summary()
print(summary.complete_text)
```

Print the text as it is generated:

```python
summary = dataset.generate_summary()
for text_chunk in summary.text_stream():
    print(text_chunk, end="", flush=True)
```

Check the summary's state without waiting:

```python
from roboto.ai.summary import AISummaryStatus
summary = dataset.generate_summary()
if summary.current and summary.current.status == AISummaryStatus.Complete:
    print("Summary is ready!")
```

#### Dataset.get_file_by_path()

```python
def get_file_by_path(
    relative_path: Union[str, pathlib.Path],
    version_id: Optional[int] = None,
) -> roboto.domain.files.File
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/datasets/dataset.py#L751-L777)

Fetch the dataset's file at a path.

It calls [`get_file_by_path()`](/docs/reference/python-sdk/roboto/domain/files/file_system#roboto.domain.files.file_system.FileSystem.get_file_by_path), whose failures also apply.

**Parameters**

- **relative_path** (`Union[str, pathlib.Path]`): Path of the file, relative to the dataset's root.
- **version_id** (`Optional[int]`): Version of the file to fetch. `None` fetches the latest version.

**Returns**

- `roboto.domain.files.File`

**Usage**

Fetch the latest version of a file:

```python
dataset = Dataset.from_id("ds_abc123")
file = dataset.get_file_by_path("logs/session1.bag")
print(file.file_id)
```

Fetch version 1 of a file:

```python
old_file = dataset.get_file_by_path("data/sensors.csv", version_id=1)
print(old_file.version)
# 1
```

#### Dataset.get_metadata()

```python
def get_metadata() -> dict[str, Any]
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/datasets/dataset.py#L460-L478)

Return a copy of the key-value metadata on the dataset.

Nested metadata comes back as nested dictionaries. When this instance was loaded without metadata, as [`find_datasets()`](/docs/reference/python-sdk/roboto/roboto_search#roboto.roboto_search.RobotoSearch.find_datasets) does by default, the first call fetches the dataset's full record from Roboto, replacing this instance's copy.

**Usage**

```python
dataset = Dataset.from_id("ds_abc123")
metadata = dataset.get_metadata()
metadata.get("vehicle_id")
```

**Returns**

- `dict[str, Any]`

#### Dataset.get_sessions()

```python
def get_sessions() -> collections.abc.Generator[roboto.experimental.sessions.Session, None, None]
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/datasets/dataset.py#L850-L864)

List the sessions that include at least one of the dataset's files.

A session is an operational time window of a device, and can include files from several datasets.

**Yields**

- Each [`Session`](/docs/reference/python-sdk/roboto/experimental/sessions/session#roboto.experimental.sessions.session.Session) that includes a file of this dataset, fetched a page at a time as the generator advances.

**Returns**

- `collections.abc.Generator[roboto.experimental.sessions.Session, None, None]`

**Usage**

```python
dataset = Dataset.from_id("ds_abc123")
for session in dataset.get_sessions():
    print(session.session_id, session.name)
```

#### Dataset.get_summary()

```python
def get_summary() -> roboto.ai.summary.StreamingAISummary
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/datasets/dataset.py#L817-L847)

Fetch the dataset's latest AI summary, without generating one.

**Returns**

- `roboto.ai.summary.StreamingAISummary`: The dataset's latest summary. If its generation is still running, the summary is [`Pending`](/docs/reference/python-sdk/roboto/ai/summary#roboto.ai.summary.AISummaryStatus.Pending); its `await_completion` and `text_stream` methods wait for the rest.

**Raises**

- [`RobotoNotFoundException`](/docs/reference/python-sdk/roboto/exceptions/domain#roboto.exceptions.domain.RobotoNotFoundException): The dataset has no AI summary. Call `generate_summary` to create one.

**Usage**

Get the existing summary, generating one first if there is none:

```python
from roboto.exceptions import RobotoNotFoundException
dataset = Dataset.from_id("ds_abc123")
try:
    summary = dataset.get_summary()
except RobotoNotFoundException:
    summary = dataset.generate_summary()
print(summary.complete_text)
```

Check whether a summary exists without generating one:

```python
try:
    summary = dataset.get_summary()
    print(summary.complete_text)
except RobotoNotFoundException:
    print("No summary yet — call generate_summary() to create one.")
```

#### Dataset.get_topic_time_bounds()

```python
def get_topic_time_bounds() -> roboto.domain.topics.TopicTimeBounds
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/datasets/dataset.py#L913-L931)

Fetch the earliest start time and latest end time across every topic in the dataset.

Returns the same values as taking the minimum `start_time` and maximum `end_time` over `get_topics`, in one request instead of one per page of topics.

**Returns**

- `roboto.domain.topics.TopicTimeBounds`: Bounds in nanoseconds since the Unix epoch. Both are `None` when the dataset's files hold no topics, and either is `None` when no topic in the dataset has that bound.

**Raises**

- [`RobotoNotFoundException`](/docs/reference/python-sdk/roboto/exceptions/domain#roboto.exceptions.domain.RobotoNotFoundException): The dataset does not exist.

**Usage**

```python
dataset = Dataset.from_id("ds_abc123")
bounds = dataset.get_topic_time_bounds()
print(bounds.start_time, bounds.end_time)
```

#### Dataset.get_topics()

```python
def get_topics(
    include: Optional[collections.abc.Sequence[str]] = None,
    exclude: Optional[collections.abc.Sequence[str]] = None,
) -> collections.abc.Generator[roboto.domain.topics.Topic, None, None]
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/datasets/dataset.py#L866-L911)

List the topics of the dataset's files, optionally filtered by name.

A topic is a sequence of structured time-series data from one file, usually extracted by ingestion. When several files have a topic with the same name, such as files split from one recording, each file's topic is yielded separately.

**Parameters**

- **include** (`Optional[collections.abc.Sequence[str]]`): Exact topic names to yield. `None` yields every topic.
- **exclude** (`Optional[collections.abc.Sequence[str]]`): Exact topic names to skip. Takes precedence over `include`. `None` skips none.

**Yields**

- Each of the dataset's [`Topic`](/docs/reference/python-sdk/roboto/domain/topics/topic#roboto.domain.topics.topic.Topic) objects that the filters admit.

**Returns**

- `collections.abc.Generator[roboto.domain.topics.Topic, None, None]`

> **Note**
>
> The topics come without message paths: each topic's `message_paths` is empty. To get them, call [`get_topics()`](/docs/reference/python-sdk/roboto/domain/files/file#roboto.domain.files.file.File.get_topics) on each file instead.

**Usage**

List every topic:

```python
dataset = Dataset.from_id("ds_abc123")
for topic in dataset.get_topics():
    print(topic.name)
```

List only the camera topics:

```python
camera_topics = list(dataset.get_topics(include=["/camera/image", "/camera/info"]))
```

List every topic except diagnostics:

```python
data_topics = list(dataset.get_topics(exclude=["/diagnostics"]))
```

#### Dataset.get_topics_by_file()

```python
def get_topics_by_file(
    relative_path: Union[str, pathlib.Path],
) -> collections.abc.Generator[roboto.domain.topics.Topic, None, None]
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/datasets/dataset.py#L933-L956)

List the topics of the dataset's file at a path.

Equivalent to `dataset.get_file_by_path(relative_path).get_topics()`. The file is looked up when this method is called, before the first topic is fetched.

**Parameters**

- **relative_path** (`Union[str, pathlib.Path]`): Path of the file, relative to the dataset's root.

**Yields**

- Each [`Topic`](/docs/reference/python-sdk/roboto/domain/topics/topic#roboto.domain.topics.topic.Topic) of the file.

**Raises**

- [`RobotoNotFoundException`](/docs/reference/python-sdk/roboto/exceptions/domain#roboto.exceptions.domain.RobotoNotFoundException): The dataset has no file at this path.

**Returns**

- `collections.abc.Generator[roboto.domain.topics.Topic, None, None]`

**Usage**

```python
dataset = Dataset.from_id("ds_abc123")
for topic in dataset.get_topics_by_file("logs/session1.bag"):
    print(topic.name)
```

#### Dataset.list_directories()

```python
def list_directories() -> collections.abc.Generator[roboto.domain.files.DirectoryRecord, None, None]
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/datasets/dataset.py#L958-L970)

List every directory in the dataset, at any depth.

It calls [`list_directories()`](/docs/reference/python-sdk/roboto/domain/files/file_system#roboto.domain.files.file_system.FileSystem.list_directories), whose failures also apply.

**Usage**

```python
dataset = Dataset.from_id("ds_abc123")
for directory in dataset.list_directories():
    print(directory.relative_path)
```

**Returns**

- `collections.abc.Generator[roboto.domain.files.DirectoryRecord, None, None]`

#### Dataset.list_files()

```python
def list_files(
    include_patterns: Optional[list[str]] = None,
    exclude_patterns: Optional[list[str]] = None,
) -> collections.abc.Generator[roboto.domain.files.File, None, None]
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/datasets/dataset.py#L972-L1009)

List the dataset's files that match the given patterns.

It calls [`list_files()`](/docs/reference/python-sdk/roboto/domain/files/file_system#roboto.domain.files.file_system.FileSystem.list_files), whose failures also apply.

**Parameters**

- **include_patterns** (`Optional[list[str]]`): Gitignore-style patterns for the files to list. `None` or an empty list selects every file.
- **exclude_patterns** (`Optional[list[str]]`): Gitignore-style patterns for files to leave out. Takes precedence over `include_patterns`. `None` or an empty list leaves out none.

**Yields**

- Each matching [`File`](/docs/reference/python-sdk/roboto/domain/files/file#roboto.domain.files.file.File), fetched a page at a time as the generator advances.

**Returns**

- `collections.abc.Generator[roboto.domain.files.File, None, None]`

> **Note**
>
> Patterns follow the gitignore format described at [https://git-scm.com/docs/gitignore](https://git-scm.com/docs/gitignore). A file appears here shortly after its upload completes, not at once.

**Usage**

List every file:

```python
dataset = Dataset.from_id("ds_abc123")
for file in dataset.list_files():
    print(file.relative_path)
```

List the image files, except those under a `back_camera` directory:

```python
for file in dataset.list_files(
    include_patterns=["**/*.png", "**/*.jpg"], exclude_patterns=["**/back_camera/**"]
):
    print(file.relative_path)
```

#### Dataset.put_metadata()

```python
def put_metadata(metadata: dict[str, Any]) -> None
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/datasets/dataset.py#L1011-L1036)

Set metadata keys on the dataset, adding new keys and overwriting existing ones.

Keys the dict does not name keep their values. A dotted key such as `"weather.condition"` sets `condition` inside the nested `weather` object.

**Parameters**

- **metadata** (`dict[str, Any]`): Key-value metadata to set on the dataset.

**Returns**

- `None`

**Usage**

```python
dataset = Dataset.from_id("ds_abc123")
dataset.put_metadata(
    {
        "vehicle_id": "vehicle_001",
        "test_type": "highway_driving",
        "weather.condition": "sunny",
        "weather.temperature": 25,
    }
)
print(dataset.get_metadata()["weather"]["condition"])
# sunny
```

#### Dataset.put_tags()

```python
def put_tags(tags: roboto.updates.StrSequence) -> None
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/datasets/dataset.py#L1038-L1058)

Add tags to the dataset, keeping its existing tags.

A tag the dataset already has is not added again.

**Parameters**

- **tags** (`roboto.updates.StrSequence`): Tags to add to the dataset.

**Returns**

- `None`

**Usage**

```python
dataset = Dataset.from_id("ds_abc123")
dataset.put_tags(["highway", "sunny"])
dataset.put_tags(["test"])
{"highway", "sunny", "test"} <= set(dataset.tags)
# True
```

#### Dataset.query()

```python
@classmethod
def query(
    spec: Optional[roboto.query.QuerySpecification] = None,
    roboto_client: Optional[roboto.http.RobotoClient] = None,
    owner_org_id: Optional[str] = None,
) -> collections.abc.Generator[Dataset, None, None]
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/datasets/dataset.py#L311-L376)

List the datasets in an organization that match a query specification.

Fetches one page of results at a time as the generator advances, and writes each page's token to `spec.after` to request the next.

**Parameters**

- **spec** (`Optional[roboto.query.QuerySpecification]`): Conditions, sort order, and page size of the query. Each condition's field must be a [`DatasetRecord`](/docs/reference/python-sdk/roboto/domain/datasets/record#roboto.domain.datasets.record.DatasetRecord) field, or a dotted path that starts with one, such as `metadata.software_version`. `None` lists every dataset in the organization.
- **roboto_client** (`Optional[roboto.http.RobotoClient]`): Client to make requests to Roboto with. Defaults to one configured from the environment, by [`from_env()`](/docs/reference/python-sdk/roboto/http/roboto_client#roboto.http.roboto_client.RobotoClient.from_env).
- **owner_org_id** (`Optional[str]`): Organization whose datasets to list. Defaults to the organization the caller acts in.

**Yields**

- Datasets that match `spec`, with their metadata.

**Raises**

- `ValueError`: `spec` names a field that is not a dataset record field. It surfaces on the first iteration, before any request.

**Returns**

- `collections.abc.Generator[Dataset, None, None]`

**Usage**

```python
from roboto.query import Comparator, Condition, QuerySpecification
spec = QuerySpecification(
    condition=Condition(field="name", comparator=Comparator.Contains, value="Roboto")
)
for dataset in Dataset.query(spec):
    print(dataset.dataset_id, dataset.name)
```

#### Dataset.refresh()

```python
def refresh() -> Dataset
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/datasets/dataset.py#L1060-L1076)

Replace this instance's record with the dataset's current record from Roboto.

Use it to see changes that other users or processes made after this instance was loaded.

**Returns**

- `Dataset`: This instance, with its record updated from Roboto's response.

**Raises**

- [`RobotoDatasetNotFoundException`](/docs/reference/python-sdk/roboto/exceptions/domain#roboto.exceptions.domain.RobotoDatasetNotFoundException): The dataset no longer exists.

**Usage**

```python
dataset = Dataset.from_id("ds_abc123")
print(dataset.refresh().tags)
```

#### Dataset.remove_metadata()

```python
def remove_metadata(metadata: roboto.updates.StrSequence) -> None
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/datasets/dataset.py#L1078-L1093)

Remove metadata keys from the dataset. Keys the dataset does not have are ignored.

A dotted key such as `"baz.qux"` removes `qux` from inside the nested `baz` object.

**Parameters**

- **metadata** (`roboto.updates.StrSequence`): Metadata keys to remove.

**Returns**

- `None`

**Usage**

```python
dataset = Dataset.from_id("ds_abc123")
dataset.remove_metadata(["foo", "baz.qux"])
```

#### Dataset.remove_tags()

```python
def remove_tags(tags: roboto.updates.StrSequence) -> None
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/datasets/dataset.py#L1095-L1110)

Remove tags from the dataset. Tags the dataset does not have are ignored.

**Parameters**

- **tags** (`roboto.updates.StrSequence`): Tags to remove from the dataset.

**Returns**

- `None`

**Usage**

```python
dataset = Dataset.from_id("ds_abc123")
dataset.remove_tags(["draft"])
"draft" in dataset.tags
# False
```

#### Dataset.rename_directory()

```python
def rename_directory(
    old_path: str,
    new_path: str,
) -> roboto.domain.files.DirectoryRecord
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/datasets/dataset.py#L1338-L1356)

Rename or move a directory in the dataset.

Both paths are relative to the dataset's root. A `new_path` with fewer components moves the directory up the tree; a different last component at the same depth renames it in place. It calls [`rename_directory()`](/docs/reference/python-sdk/roboto/domain/files/file_system#roboto.domain.files.file_system.FileSystem.rename_directory), whose failures also apply.

**Parameters**

- **old_path** (`str`): Current path of the directory, such as `"logs/session1"`.
- **new_path** (`str`): New path of the directory, such as `"session1"` to move it up one level.

**Returns**

- `roboto.domain.files.DirectoryRecord`: Record of the directory at its new path.

**Usage**

```python
dataset = Dataset.from_id("ds_abc123")
dataset.rename_directory("logs/session1", "session1")
```

#### Dataset.rename_file()

```python
def rename_file(file_id: str, new_path: str) -> roboto.domain.files.FileRecord
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/datasets/dataset.py#L1358-L1378)

Rename or move a file in the dataset.

The file keeps its ID and versions; only its path changes. It calls [`rename_file()`](/docs/reference/python-sdk/roboto/domain/files/file_system#roboto.domain.files.file_system.FileSystem.rename_file), whose failures also apply.

**Parameters**

- **file_id** (`str`): ID of the file to rename or move.
- **new_path** (`str`): New path of the file, relative to the dataset's root, such as `"file.bag"` to move it to the root or `"other_dir/file.bag"` to move it into an existing directory.

**Returns**

- `roboto.domain.files.FileRecord`: Record of the file at its new path.

**Usage**

```python
dataset = Dataset.from_id("ds_abc123")
record = dataset.rename_file("fl_xyz789", "file.bag")
record.relative_path
# 'file.bag'
```

#### Dataset.set_custom_field()

```python
def set_custom_field(name: str, value: Any) -> Dataset
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/datasets/dataset.py#L1113-L1130)

Set one custom-field value on the dataset.

It calls `update`, whose failures also apply.

**Parameters**

- **name** (`str`): Name of a custom field defined for datasets in the dataset's organization, with status [`Ready`](/docs/reference/python-sdk/roboto/domain/custom_fields/record#roboto.domain.custom_fields.record.CustomFieldStatus.Ready).
- **value** (`Any`): Value to set, which must match the field's declared type.

**Returns**

- `Dataset`: This instance, with its record updated from Roboto's response.

**Usage**

```python
dataset = Dataset.from_id("ds_abc123")
dataset.set_custom_field("flight_count", 12)
```

#### Dataset.set_custom_fields()

```python
def set_custom_fields(fields: dict[str, Any]) -> Dataset
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/datasets/dataset.py#L1152-L1169)

Set several custom-field values on the dataset. Fields not named keep their values.

It calls `update`, whose failures also apply.

**Parameters**

- **fields** (`dict[str, Any]`): New values keyed by field name. Each name must be a custom field defined for datasets in the dataset's organization, with status [`Ready`](/docs/reference/python-sdk/roboto/domain/custom_fields/record#roboto.domain.custom_fields.record.CustomFieldStatus.Ready), and each value must match that field's declared type.

**Returns**

- `Dataset`: This instance, with its record updated from Roboto's response.

**Usage**

```python
dataset = Dataset.from_id("ds_abc123")
dataset.set_custom_fields({"drone_id": "DJI-X", "flight_count": 12})
```

#### Dataset.set_device_id()

```python
def set_device_id(
    device_id: Optional[str],
    create_device_if_missing: bool = False,
) -> Dataset
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/datasets/dataset.py#L1189-L1210)

Set or clear the device the dataset's data came from.

It calls `update`, whose failures also apply.

**Parameters**

- **device_id** (`Optional[str]`): ID of a device in the dataset's organization. `None` clears the dataset's device.
- **create_device_if_missing** (`bool`): Whether to create the device named by `device_id` when the organization has no such device, then update the dataset again. When `False`, a missing device raises [`RobotoDeviceNotFoundException`](/docs/reference/python-sdk/roboto/exceptions/domain#roboto.exceptions.domain.RobotoDeviceNotFoundException).

**Returns**

- `Dataset`: This instance, with its record updated from Roboto's response.

**Usage**

```python
dataset = Dataset.from_id("ds_abc123")
dataset.set_device_id("rover-01", create_device_if_missing=True)
```

#### Dataset.set_summary()

```python
def set_summary(summary: str) -> Dataset
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/datasets/dataset.py#L1212-L1234)

Replace the dataset's AI summary with the given text.

Use it when an action or other process can write a more specific summary than `generate_summary` would. The text becomes the summary that `get_summary` returns and the Roboto web app shows.

**Parameters**

- **summary** (`str`): Text of the summary, rendered as Markdown. It can include `roboto://` links to Roboto resources, which the Roboto web app renders as links.

**Returns**

- `Dataset`: This instance. Its record is unchanged until you fetch it again.

**Usage**

```python
dataset = Dataset.from_id("ds_abc123")
dataset.set_summary("Highway drive, 42 minutes, no disengagements.")
```

#### Dataset.to_association()

```python
def to_association() -> roboto.association.Association
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/datasets/dataset.py#L1236-L1244)

Return an association that refers to the dataset, for APIs that take one.

**Usage**

```python
dataset = Dataset.from_id("ds_abc123")
dataset.to_association().association_id
# 'ds_abc123'
```

**Returns**

- `roboto.association.Association`

#### Dataset.to_dict()

```python
def to_dict() -> dict[str, Any]
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/datasets/dataset.py#L1246-L1255)

Return the record this instance holds, as a JSON-compatible dictionary.

**Usage**

```python
dataset = Dataset.from_id("ds_abc123")
dataset_dict = dataset.to_dict()
dataset_dict["dataset_id"]
# 'ds_abc123'
```

**Returns**

- `dict[str, Any]`

#### Dataset.update()

```python
def update(
    description: Optional[Union[str, roboto.sentinels.NotSetType]] = NotSet,
    device_id: Optional[Union[str, roboto.sentinels.NotSetType]] = NotSet,
    metadata_changeset: Union[roboto.updates.MetadataChangeset, roboto.sentinels.NotSetType] = NotSet,
    name: Optional[Union[str, roboto.sentinels.NotSetType]] = NotSet,
    create_device_if_missing: bool = False,
    custom_fields_changeset: Optional[roboto.updates.CustomFieldChangeset] = None,
) -> Dataset
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/datasets/dataset.py#L1257-L1336)

Update the dataset's properties. Arguments left unset leave their property unchanged.

**Parameters**

- **description** (`Optional[Union[str, roboto.sentinels.NotSetType]]`): Human-readable description of the dataset. `None` clears it.
- **device_id** (`Optional[Union[str, roboto.sentinels.NotSetType]]`): ID of the device that produced the dataset's data, which must be in the dataset's organization. `None` clears it.
- **metadata_changeset** (`Union[roboto.updates.MetadataChangeset, roboto.sentinels.NotSetType]`): Changes to the dataset's tags and metadata.
- **name** (`Optional[Union[str, roboto.sentinels.NotSetType]]`): Human-readable name of the dataset, at most 120 characters. `None` clears it.
- **create_device_if_missing** (`bool`): Whether to create the device named by `device_id` when the organization has no such device, then update the dataset again. When `False`, a missing device raises [`RobotoDeviceNotFoundException`](/docs/reference/python-sdk/roboto/exceptions/domain#roboto.exceptions.domain.RobotoDeviceNotFoundException).
- **custom_fields_changeset** (`Optional[roboto.updates.CustomFieldChangeset]`): Changes to the dataset's custom-field values. Fields the changeset does not name keep their values. `None` changes none.

**Returns**

- `Dataset`: This instance, with its record updated from Roboto's response.

**Raises**

- [`RobotoDeviceNotFoundException`](/docs/reference/python-sdk/roboto/exceptions/domain#roboto.exceptions.domain.RobotoDeviceNotFoundException): `device_id` names no device in the dataset's organization, and `create_device_if_missing` is `False`.
- [`RobotoIllegalArgumentException`](/docs/reference/python-sdk/roboto/exceptions/domain#roboto.exceptions.domain.RobotoIllegalArgumentException): The custom-field changeset names a field that is not a ready custom field for datasets, or sets a value that does not match its field's type.

**Usage**

Rename the dataset and change its description:

```python
dataset = Dataset.from_id("ds_abc123")
dataset.update(name="Updated Highway Test Session", description="Updated description")
print(dataset.name)
# Updated Highway Test Session
```

Set a metadata key:

```python
from roboto.updates import MetadataChangeset
dataset.update(metadata_changeset=MetadataChangeset(put_fields={"processed": True}))
```

Clear the dataset's device and description:

```python
dataset.update(device_id=None, description=None)
```

#### Dataset.upload_directory()

```python
def upload_directory(
    directory_path: pathlib.Path,
    include_patterns: Optional[list[str]] = None,
    exclude_patterns: Optional[list[str]] = None,
    delete_after_upload: bool = False,
    max_batch_size: int = MAX_FILES_PER_MANIFEST,
    print_progress: bool = True,
    device_id: Optional[str] = None,
) -> None
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/datasets/dataset.py#L1380-L1431)

Upload every file under a local directory, at any depth, to the dataset.

Each file is uploaded to its path relative to `directory_path`, so the dataset mirrors the local layout. It calls [`upload_directory()`](/docs/reference/python-sdk/roboto/domain/files/file_system#roboto.domain.files.file_system.FileSystem.upload_directory), whose failures also apply.

**Parameters**

- **directory_path** (`pathlib.Path`): Local directory whose files to upload.
- **include_patterns** (`Optional[list[str]]`): Gitignore-style patterns for the files to upload. `None` uploads every file; an empty list uploads none.
- **exclude_patterns** (`Optional[list[str]]`): Gitignore-style patterns for files to skip. Takes precedence over `include_patterns`.
- **delete_after_upload** (`bool`): Whether to delete each uploaded local file once every upload has succeeded. Directories are kept.
- **max_batch_size** (`int`): Maximum number of files per upload batch. Each batch finishes uploading before the next starts.
- **print_progress** (`bool`): Whether to show a progress bar during the upload.
- **device_id** (`Optional[str]`): ID of the device that produced the files' data.

**Returns**

- `None`

> **Note**
>
> Patterns follow the gitignore format described at [https://git-scm.com/docs/gitignore#\_pattern_format](https://git-scm.com/docs/gitignore#_pattern_format), but each is matched against a file's name only, not its path under `directory_path`. A pattern naming a directory, such as `"__pycache__/"`, matches no file.

**Usage**

Upload a directory, skipping compiled Python and log files:

```python
import pathlib
dataset = Dataset.from_id("ds_abc123")
dataset.upload_directory(
    pathlib.Path("/path/to/directory"),
    exclude_patterns=["*.pyc", "*.log"],
)
```

#### Dataset.upload_file()

```python
def upload_file(
    file_path: pathlib.Path,
    file_destination_path: Optional[str] = None,
    print_progress: bool = True,
    device_id: Optional[str] = None,
) -> roboto.domain.files.File
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/datasets/dataset.py#L1433-L1462)

Upload one local file to the dataset.

It calls [`upload_file()`](/docs/reference/python-sdk/roboto/domain/files/file_system#roboto.domain.files.file_system.FileSystem.upload_file), whose failures also apply.

**Parameters**

- **file_path** (`pathlib.Path`): Local file to upload.
- **file_destination_path** (`Optional[str]`): Path within the dataset to upload the file to. `None` uploads it to the dataset's root under its own name.
- **print_progress** (`bool`): Whether to show a progress bar during the upload.
- **device_id** (`Optional[str]`): ID of the device that produced the file's data.

**Returns**

- `roboto.domain.files.File`: The uploaded file. Its record is fetched from Roboto the first time it is read.

**Usage**

```python
import pathlib
dataset = Dataset.from_id("ds_abc123")
file = dataset.upload_file(
    pathlib.Path("/path/to/file.txt"),
    file_destination_path="foo/bar.txt",
)
```

#### Dataset.upload_files()

```python
def upload_files(
    files: collections.abc.Iterable[pathlib.Path],
    file_destination_paths: collections.abc.Mapping[pathlib.Path, str] = {},
    max_batch_size: int = MAX_FILES_PER_MANIFEST,
    print_progress: bool = True,
    device_id: Optional[str] = None,
) -> dict[pathlib.Path, str]
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/datasets/dataset.py#L1464-L1499)

Upload several local files to the dataset.

It calls [`upload_files()`](/docs/reference/python-sdk/roboto/domain/files/file_system#roboto.domain.files.file_system.FileSystem.upload_files), whose failures also apply.

**Parameters**

- **files** (`collections.abc.Iterable[pathlib.Path]`): Local files to upload.
- **file_destination_paths** (`collections.abc.Mapping[pathlib.Path, str]`): Path within the dataset to upload each local file to, keyed by local path. A file not in the mapping is uploaded to the dataset's root under its own name.
- **max_batch_size** (`int`): Maximum number of files per upload batch. Each batch finishes uploading before the next starts.
- **print_progress** (`bool`): Whether to show a progress bar during the upload.
- **device_id** (`Optional[str]`): ID of the device that produced the files' data.

**Returns**

- `dict[pathlib.Path, str]`: ID of the file each local path was uploaded as, keyed by local path.

**Usage**

```python
import pathlib
dataset = Dataset.from_id("ds_abc123")
file_ids = dataset.upload_files(
    [pathlib.Path("/path/to/file.txt")],
    file_destination_paths={
        pathlib.Path("/path/to/file.txt"): "foo/bar.txt",
    },
)
print(file_ids[pathlib.Path("/path/to/file.txt")])
```

### logger

```python
roboto.domain.datasets.dataset.logger
```

`from roboto.domain.datasets.dataset import logger`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/datasets/dataset.py#L58-L58)
