---
sidebar:
  label: roboto.query.api
  order: 0
title: roboto.query.api
---
## Module Contents

### QualifiedRoboqlQuery

```python
class roboto.query.api.QualifiedRoboqlQuery(/, **data: Any)
```

`from roboto.query import QualifiedRoboqlQuery`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/query/api.py#L147-L153)

Bases: `pydantic.BaseModel`

A RoboQL query which has been qualified with a target.

**Parameters**

- **data** (`Any`)

**Attributes**

- **QualifiedRoboqlQuery.query** (`str`) = `None`
- **QualifiedRoboqlQuery.target** (`QueryTarget`) = `None`

### QueryContentMode

```python
class roboto.query.api.QueryContentMode
```

`from roboto.query import QueryContentMode`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/query/api.py#L56-L81)

Bases: `roboto.compat.StrEnum`

Hint to query APIs on whether to return Roboto entities with custom metadata.

In `RecordOnly` mode, Roboto entities are returned without custom metadata, ensuring a smaller and more predictable response size. Use this mode when you need lower query latency, larger result page sizes, or both.

In `RecordWithMeta` mode, Roboto entities are returned with all available custom metadata. Use this mode if you need immediate access to metadata fields.

Note: content mode support is initially available for dataset queries, and will be added incrementally for other entity types.

**Attributes**

- **QueryContentMode.RecordOnly** = `'record_only'`: Query results are returned with core Roboto data attributes only.

  Those attributes establish the identity and function of Roboto entities.

- **QueryContentMode.RecordWithMeta** = `'record_with_meta'`: Query results are returned with all available entity attributes.

  This includes core Roboto data attributes as well as custom metadata.

### QueryContext

```python
class roboto.query.api.QueryContext(/, **data: Any)
```

`from roboto.query import QueryContext`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/query/api.py#L96-L102)

Bases: `pydantic.BaseModel`

Context for a query

**Parameters**

- **data** (`Any`)

**Attributes**

- **QueryContext.query** (`dict[str, Any]`) = `None`
- **QueryContext.query_scheme** (`QueryScheme`)

### QueryRecord

```python
class roboto.query.api.QueryRecord(/, **data: Any)
```

`from roboto.query import QueryRecord`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/query/api.py#L126-L144)

Bases: `pydantic.BaseModel`

A wire-transmissible representation of a query.

**Parameters**

- **data** (`Any`)

**Attributes**

- **QueryRecord.modified** (`datetime.datetime`) = `None`
- **QueryRecord.org_id** (`str`) = `None`
- **QueryRecord.query_ctx** (`QueryContext`) = `None`
- **QueryRecord.query_id** (`str`) = `None`
- **QueryRecord.result_count** (`int`) = `None`
- **QueryRecord.status** (`QueryStatus`) = `None`
- **QueryRecord.submitted** (`datetime.datetime`) = `None`
- **QueryRecord.submitted_by** (`str`) = `None`
- **QueryRecord.target** (`QueryTarget`) = `None`

### QueryScheme

```python
class roboto.query.api.QueryScheme
```

`from roboto.query import QueryScheme`

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

Bases: `roboto.compat.StrEnum`

A specific query format/schema which can be used in combination with some context JSON to provide all information required to execute a query.

**Attributes**

- **QueryScheme.QuerySpecV1** = `'query_spec_v1'`: The initial variant of roboto.query.QuerySpecification which powered search since mid 2023.

### QueryStatus

```python
class roboto.query.api.QueryStatus(*args, **kwds)
```

`from roboto.query import QueryStatus`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/query/api.py#L32-L53)

Bases: `enum.Enum`

The query lifecycle state of a given query.

**Attributes**

- **QueryStatus.Failed** = `'failed'`: Indicates the query failed to execute.

- **QueryStatus.ResultsAvailable** = `'results_available'`: Indicates that query results are available for clients to retrieve.

  Results might be available immediately, such as in paginated database search, or once a (potentially expensive) calculation completes for more advanced search modalities.

- **QueryStatus.Scheduled** = `'scheduled'`: Indicates the query is scheduled for execution.

### QueryStorageContext

```python
class roboto.query.api.QueryStorageContext(/, **data: Any)
```

`from roboto.query import QueryStorageContext`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/query/api.py#L117-L123)

Bases: `pydantic.BaseModel`

Context for query storage

**Parameters**

- **data** (`Any`)

**Attributes**

- **QueryStorageContext.storage_ctx** (`dict[str, Any]`) = `None`
- **QueryStorageContext.storage_scheme** (`QueryStorageScheme`)

### QueryStorageScheme

```python
class roboto.query.api.QueryStorageScheme
```

`from roboto.query import QueryStorageScheme`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/query/api.py#L105-L114)

Bases: `roboto.compat.StrEnum`

A specific query result storage format/schema which can be used in combination with some context JSON to provide all information required to vend query results

**Attributes**

- **QueryStorageScheme.S3ManifestV1** = `'s3_manifest_v1'`: Query results are in S3, and a manifest file enumerates the result parts and how to resolve them into rows.

### QueryTarget

```python
class roboto.query.api.QueryTarget
```

`from roboto.query import QueryTarget`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/query/api.py#L17-L29)

Bases: `roboto.compat.StrEnum`

The type of resource a specific query is requesting.

**Attributes**

- **QueryTarget.Collections** = `'collections'`
- **QueryTarget.Datasets** = `'datasets'`
- **QueryTarget.Devices** = `'devices'`
- **QueryTarget.Events** = `'events'`
- **QueryTarget.Files** = `'files'`
- **QueryTarget.Sessions** = `'sessions'`
- **QueryTarget.TopicMessagePaths** = `'topic_message_paths'`
- **QueryTarget.Topics** = `'topics'`

### SubmitRoboqlQueryRequest

```python
class roboto.query.api.SubmitRoboqlQueryRequest(/, **data: Any)
```

`from roboto.query import SubmitRoboqlQueryRequest`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/query/api.py#L168-L179)

Bases: `pydantic.BaseModel`

Request payload to submit a RoboQL query

**Parameters**

- **data** (`Any`)

**Attributes**

- **SubmitRoboqlQueryRequest.content_mode** (`QueryContentMode`) = `None`
- **SubmitRoboqlQueryRequest.query** (`str | None`) = `None`
- **SubmitRoboqlQueryRequest.target** (`QueryTarget`) = `None`

### SubmitStructuredQueryRequest

```python
class roboto.query.api.SubmitStructuredQueryRequest(/, **data: Any)
```

`from roboto.query import SubmitStructuredQueryRequest`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/query/api.py#L156-L165)

Bases: `pydantic.BaseModel`

Request payload to submit a structured query

**Parameters**

- **data** (`Any`)

**Attributes**

- **SubmitStructuredQueryRequest.content_mode** (`QueryContentMode`) = `None`
- **SubmitStructuredQueryRequest.query** (`roboto.query.specification.QuerySpecification`) = `None`
- **SubmitStructuredQueryRequest.target** (`QueryTarget`) = `None`

### SubmitTermQueryRequest

```python
class roboto.query.api.SubmitTermQueryRequest(/, **data: Any)
```

`from roboto.query import SubmitTermQueryRequest`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/query/api.py#L182-L194)

Bases: `pydantic.BaseModel`

Request payload to submit a simple term query

**Parameters**

- **data** (`Any`)

**Attributes**

- **SubmitTermQueryRequest.content_mode** (`QueryContentMode`) = `None`
- **SubmitTermQueryRequest.target** (`QueryTarget`) = `None`
- **SubmitTermQueryRequest.term** (`str`) = `None`
