Skip to content
Roboto
Esc
↑↓navigate↵open⌘Jpreview
On this page

roboto.query.conditions

Module Contents

Comparator

class roboto.query.conditions.Comparator#View Source

Bases: roboto.compat.StrEnum

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

Attributes

Comparator.BeginsWith

BeginsWith = 'BEGINS_WITH' #

Comparator.Contains

Contains = 'CONTAINS' #

Comparator.Equals

Equals = 'EQUALS' #

Comparator.Exists

Exists = 'EXISTS' #

Comparator.GreaterThan

GreaterThan = 'GREATER_THAN' #

Comparator.GreaterThanOrEqual

GreaterThanOrEqual = 'GREATER_THAN_OR_EQUAL' #

Comparator.IsNotNull

IsNotNull = 'IS_NOT_NULL' #

Comparator.IsNull

IsNull = 'IS_NULL' #

Comparator.LessThan

LessThan = 'LESS_THAN' #

Comparator.LessThanOrEqual

LessThanOrEqual = 'LESS_THAN_OR_EQUAL' #

Comparator.Like

Like = 'LIKE' #

Comparator.NotContains

NotContains = 'NOT_CONTAINS' #

Comparator.NotEquals

NotEquals = 'NOT_EQUALS' #

Comparator.NotExists

NotExists = 'NOT_EXISTS' #

Comparator.NotLike

NotLike = 'NOT_LIKE' #

Comparator.from_string()

static from_string(value)#View Source

Parameters

value str

Return type

Comparator.to_compact_string()

to_compact_string()#View Source

Condition

class roboto.query.conditions.Condition(/, **data)#View Source

Bases: pydantic.BaseModel

A filter for any arbitrary attribute for a Roboto resource.

Parameters

data Any

Attributes

Condition.comparator

comparator Comparator #

Condition.equals_cond()

classmethod equals_cond(field, value)#View Source

Parameters

field str

Return type

Attributes

Condition.field

field Annotated[str, Field] #

Condition.matches()

matches(target)#View Source

Parameters

target dict

Return type

bool

Condition.target_unspecified()

target_unspecified()#View Source

Is the target resource of this query condition unspecified?

Return type

bool

Condition.targets_dataset()

targets_dataset()#View Source

Does this query condition target a dataset?

Return type

bool

Condition.targets_file()

targets_file()#View Source

Does this query condition target a file?

Return type

bool

Condition.targets_message_path()

targets_message_path()#View Source

Does this query condition target a message path?

Return type

bool

Condition.targets_topic()

targets_topic()#View Source

Does this query condition target a topic?

Return type

bool

Attributes

Condition.value

value ConditionValue = None #

ConditionGroup

class roboto.query.conditions.ConditionGroup(/, **data)#View Source

Bases: pydantic.BaseModel

A group of conditions that are combined together.

Parameters

data Any

ConditionGroup.and_group()

static and_group(*conditions)#View Source

Parameters

conditions ConditionType

Return type

Attributes

ConditionGroup.conditions

conditions collections.abc.Sequence[ConditionType] #

ConditionGroup.matches()

matches(target)#View Source

Parameters

target dict | Callable[[ConditionType], bool]

Attributes

ConditionGroup.operator

ConditionGroup.or_group()

static or_group(*conditions)#View Source

Parameters

conditions ConditionType

Return type

ConditionGroup.validate_conditions()

validate_conditions(v)#View Source

Parameters

v collections.abc.Sequence[ConditionType]

ConditionOperator

class roboto.query.conditions.ConditionOperator#View Source

Bases: roboto.compat.StrEnum

The operator to use when combining multiple conditions.

Attributes

ConditionOperator.And

And = 'AND' #

ConditionOperator.Not

Not = 'NOT' #

ConditionOperator.Or

Or = 'OR' #

ConditionOperator.from_string()

static from_string(value)#View Source

Parameters

value str

ConditionType

roboto.query.conditions.ConditionType#View Source

ConditionValue

roboto.query.conditions.ConditionValue#View Source

Field

class roboto.query.conditions.Field(path)#View Source

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

field = Field("dataset.metadata.foo")
field.target.resource
# 'dataset'
field.target.path
# 'metadata.foo'
field = Field("org_id")
field.target.resource is None
# True
field.target.path
# 'org_id'

Parameters

path str

Properties

Field.target

target FieldTarget #
Return type: FieldTarget

Field.wrap()

classmethod wrap(field)#View Source

Parameters

field Union[str, Field]

Return type

FieldTarget

class roboto.query.conditions.FieldTarget#View Source

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

target = FieldTarget("org_id", "dataset")
target.path
# 'org_id'
target.resource
# 'dataset'
target = FieldTarget("metadata.min", None)
target.resource is None
# True

Attributes

FieldTarget.path

path str #

Field path within the target resource, using dot notation for nested fields.

FieldTarget.resource

resource Literal['dataset', 'file', 'topic', 'message_path'] | None #

Optional resource type hint to disambiguate field path interpretation.

Was this page helpful?