---
sidebar:
  label: roboto.query.conditions
  order: 2
title: roboto.query.conditions
---
## Module Contents

### Comparator

```python
class roboto.query.conditions.Comparator
```

`from roboto.query import Comparator`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/query/conditions.py#L78-L142)

Bases: `roboto.compat.StrEnum`

The comparator to use when comparing a field to a value.

**Attributes**

- **Comparator.BeginsWith** = `'BEGINS_WITH'`
- **Comparator.Contains** = `'CONTAINS'`
- **Comparator.Equals** = `'EQUALS'`
- **Comparator.Exists** = `'EXISTS'`
- **Comparator.GreaterThan** = `'GREATER_THAN'`
- **Comparator.GreaterThanOrEqual** = `'GREATER_THAN_OR_EQUAL'`
- **Comparator.IsNotNull** = `'IS_NOT_NULL'`
- **Comparator.IsNull** = `'IS_NULL'`
- **Comparator.LessThan** = `'LESS_THAN'`
- **Comparator.LessThanOrEqual** = `'LESS_THAN_OR_EQUAL'`
- **Comparator.Like** = `'LIKE'`
- **Comparator.NotContains** = `'NOT_CONTAINS'`
- **Comparator.NotEquals** = `'NOT_EQUALS'`
- **Comparator.NotExists** = `'NOT_EXISTS'`
- **Comparator.NotLike** = `'NOT_LIKE'`

#### Comparator.from_string()

```python
@staticmethod
def from_string(value: str) -> Comparator
```

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

**Parameters**

- **value** (`str`)

**Returns**

- `Comparator`

#### Comparator.to_compact_string()

```python
def to_compact_string()
```

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

### Condition

```python
class roboto.query.conditions.Condition(/, **data: Any)
```

`from roboto.query import Condition`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/query/conditions.py#L298-L416)

Bases: `pydantic.BaseModel`

A filter for any arbitrary attribute for a Roboto resource.

**Parameters**

- **data** (`Any`)

**Attributes**

- **Condition.comparator** (`Comparator`)
- **Condition.field** (`Annotated[str, Field]`)
- **Condition.value** (`ConditionValue`) = `None`

#### Condition.equals_cond()

```python
@classmethod
def equals_cond(field: str, value: ConditionValue) -> Condition
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/query/conditions.py#L306-L307)

**Parameters**

- **field** (`str`)
- **value** (`ConditionValue`)

**Returns**

- `Condition`

#### Condition.matches()

```python
def matches(target: dict) -> bool
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/query/conditions.py#L322-L396)

**Parameters**

- **target** (`dict`)

**Returns**

- `bool`

#### Condition.target_unspecified()

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

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/query/conditions.py#L398-L400)

Is the target resource of this query condition unspecified?

**Returns**

- `bool`

#### Condition.targets_dataset()

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

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/query/conditions.py#L402-L404)

Does this query condition target a dataset?

**Returns**

- `bool`

#### Condition.targets_file()

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

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/query/conditions.py#L406-L408)

Does this query condition target a file?

**Returns**

- `bool`

#### Condition.targets_message_path()

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

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/query/conditions.py#L414-L416)

Does this query condition target a message path?

**Returns**

- `bool`

#### Condition.targets_topic()

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

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/query/conditions.py#L410-L412)

Does this query condition target a topic?

**Returns**

- `bool`

### ConditionGroup

```python
class roboto.query.conditions.ConditionGroup(/, **data: Any)
```

`from roboto.query import ConditionGroup`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/query/conditions.py#L438-L480)

Bases: `pydantic.BaseModel`

A group of conditions that are combined together.

**Parameters**

- **data** (`Any`)

**Attributes**

- **ConditionGroup.conditions** (`collections.abc.Sequence[ConditionType]`)
- **ConditionGroup.operator** (`ConditionOperator`)

#### ConditionGroup.and_group()

```python
@staticmethod
def and_group(*conditions: ConditionType) -> ConditionGroup
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/query/conditions.py#L466-L467)

**Parameters**

- **conditions** (`ConditionType`)

**Returns**

- `ConditionGroup`

#### ConditionGroup.matches()

```python
def matches(target: dict | Callable[[ConditionType], bool])
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/query/conditions.py#L444-L459)

**Parameters**

- **target** (`dict | Callable[[ConditionType], bool]`)

#### ConditionGroup.or_group()

```python
@staticmethod
def or_group(*conditions: ConditionType) -> ConditionGroup
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/query/conditions.py#L462-L463)

**Parameters**

- **conditions** (`ConditionType`)

**Returns**

- `ConditionGroup`

#### ConditionGroup.validate_conditions()

```python
def validate_conditions(v: collections.abc.Sequence[ConditionType])
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/query/conditions.py#L470-L474)

**Parameters**

- **v** (`collections.abc.Sequence[ConditionType]`)

### ConditionOperator

```python
class roboto.query.conditions.ConditionOperator
```

`from roboto.query import ConditionOperator`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/query/conditions.py#L419-L435)

Bases: `roboto.compat.StrEnum`

The operator to use when combining multiple conditions.

**Attributes**

- **ConditionOperator.And** = `'AND'`
- **ConditionOperator.Not** = `'NOT'`
- **ConditionOperator.Or** = `'OR'`

#### ConditionOperator.from_string()

```python
@staticmethod
def from_string(value: str) -> ConditionOperator
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/query/conditions.py#L427-L435)

**Parameters**

- **value** (`str`)

**Returns**

- `ConditionOperator`

### ConditionType

```python
roboto.query.conditions.ConditionType
```

`from roboto.query import ConditionType`

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

### ConditionValue

```python
roboto.query.conditions.ConditionValue
```

`from roboto.query import ConditionValue`

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

### Field

```python
class roboto.query.conditions.Field(path: str)
```

`from roboto.query import Field`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/query/conditions.py#L171-L295)

Bases: `str`

A string-like field path that parses resource qualifiers and extracts the target path.

Field extends str to provide automatic parsing of qualified field paths like "dataset.metadata.owner" or "topic.name" into their constituent parts. It identifies the target resource type (dataset, file, topic, or message_path) and extracts the actual field path within that resource.

The class supports both qualified paths (e.g., "dataset.org_id") and unqualified paths (e.g., "org_id"). For qualified paths, it strips the resource prefix and stores both the original fully qualified path and the extracted target information.

**Usage**

```python
field = Field("dataset.metadata.foo")
field.target.resource
# 'dataset'
field.target.path
# 'metadata.foo'
```

```python
field = Field("org_id")
field.target.resource is None
# True
field.target.path
# 'org_id'
```

**Parameters**

- **path** (`str`)

**Properties**

- **Field.target** (`FieldTarget`)

#### Field.wrap()

```python
@classmethod
def wrap(field: Union[str, Field]) -> Field
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/query/conditions.py#L209-L213)

**Parameters**

- **field** (`Union[str, Field]`)

**Returns**

- `Field`

### FieldTarget

```python
class roboto.query.conditions.FieldTarget
```

`from roboto.query.conditions import FieldTarget`

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

Bases: `NamedTuple`

An immutable field path with an optional resource type hint for query interpretation.

FieldTarget pairs a field path with an optional resource qualifier to help the query system resolve which resource type the field belongs to (dataset, file, topic, or message_path). When the resource is omitted, the query context infers it.

**Usage**

```python
target = FieldTarget("org_id", "dataset")
target.path
# 'org_id'
target.resource
# 'dataset'
```

```python
target = FieldTarget("metadata.min", None)
target.resource is None
# True
```

**Attributes**

- **FieldTarget.path** (`str`): Field path within the target resource, using dot notation for nested fields.
- **FieldTarget.resource** (`Literal['dataset', 'file', 'topic', 'message_path'] | None`): Optional resource type hint to disambiguate field path interpretation.
