roboto.query
Submodules
Package Contents
BaseVisitor
Bases: ConditionVisitor
Query base visitor
BaseVisitor.visit_condition()
Parameters
condition roboto.Return type
BaseVisitor.visit_condition_group()
Parameters
condition_group roboto.Return type
BooleanFilter
Bases: _FilterBase
True or false, or unset.
Parameters
data AnyAttributes
BooleanFilter.comparator
BooleanFilter.type
BooleanFilter.values
Comparator
Bases: roboto.compat.StrEnum
The comparator to use when comparing a field to a value.
Attributes
Comparator.BeginsWith
Comparator.Contains
Comparator.Equals
Comparator.Exists
Comparator.GreaterThan
Comparator.GreaterThanOrEqual
Comparator.IsNotNull
Comparator.IsNull
Comparator.LessThan
Comparator.LessThanOrEqual
Comparator.Like
Comparator.NotContains
Comparator.NotEquals
Comparator.NotExists
Comparator.NotLike
Comparator.from_string()
Parameters
value strReturn type
Comparator.to_compact_string()
Condition
Bases: pydantic.BaseModel
A filter for any arbitrary attribute for a Roboto resource.
Parameters
data AnyAttributes
Condition.comparator
Condition.equals_cond()
Parameters
field strvalue ConditionValueReturn type
Condition.matches()
Parameters
target dictReturn type
Condition.target_unspecified()
Is the target resource of this query condition unspecified?
Return type
Condition.targets_dataset()
Does this query condition target a dataset?
Return type
Condition.targets_file()
Does this query condition target a file?
Return type
Condition.targets_message_path()
Does this query condition target a message path?
Return type
Condition.targets_topic()
Does this query condition target a topic?
Return type
Attributes
Condition.value
ConditionGroup
Bases: pydantic.BaseModel
A group of conditions that are combined together.
Parameters
data AnyConditionGroup.and_group()
Parameters
conditions ConditionTypeReturn type
Attributes
ConditionGroup.conditions
ConditionGroup.matches()
Parameters
target dict | Callable[[ConditionType], bool]Attributes
ConditionGroup.operator
ConditionGroup.or_group()
Parameters
conditions ConditionTypeReturn type
ConditionGroup.validate_conditions()
Parameters
v collections.ConditionOperator
Bases: roboto.compat.StrEnum
The operator to use when combining multiple conditions.
ConditionOperator.from_string()
Parameters
value strReturn type
ConditionType
ConditionValue
ConditionVisitor
Bases: abc.ABC
Query condition visitor
ConditionVisitor.visit()
Parameters
Return type
ConditionVisitor.visit_condition()
Parameters
condition roboto.Return type
ConditionVisitor.visit_condition_group()
Parameters
condition_group roboto.Return type
DEFAULT_PAGE_SIZE
Default page size for search.
DateFilter
Bases: _FilterBase
Instants and ranges. Values are ISO 8601 strings.
The only variant offering relative windows, which is where the fidelity problem this whole model exists for actually bites.
Parameters
data AnyAttributes
DateFilter.comparator
comparator Literal[roboto.DateFilter.type
DateFilter.values
EnumFilter
Bases: _FilterBase
Equality against a closed set of options.
Parameters
data AnyAttributes
EnumFilter.comparator
EnumFilter.type
EnumFilter.values
Field
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 strProperties
Field.wrap()
Filter
One filter row. type selects the variant, and with it the operators on offer.
FilterMatchMode
FilterOnlyComparator
Bases: roboto.compat.StrEnum
Operators a saved filter needs that Comparator cannot express.
Every member is a gap in the query language, and this enum is the list of them. It is the complement of Comparator, never a superset: a member here that Comparator can express is a stale entry.
Members are removed one at a time as Comparator grows to cover them. The wire values do not change when that happens, so filters saved beforehand keep parsing.
Attributes
FilterOnlyComparator.Between
An inclusive range. Translates to GTE and LTE, which loses the fact that the author expressed one range rather than two independent bounds.
FilterOnlyComparator.Last24Hours
FilterOnlyComparator.Last30Days
FilterOnlyComparator.Last3Hours
FilterOnlyComparator.Last7Days
FilterOnlyComparator.Last8Hours
FilterOnlyComparator.Last90Days
FilterOnlyComparator.ThisMonth
Relative windows, resolved against “now” when the filter runs.
These are the members that matter. The others cost fidelity; these cost correctness — a resolved window is wrong the day after it is saved, and nothing about the stored value says so.
FilterOnlyComparator.Today
IdentityComparator
Bases: roboto.compat.StrEnum
Operators over a principal-valued field, where the operator names a principal type.
An audit column such as created_by stores a fully-qualified principal — user:<user_id>, device:<device_id>@<org_id>, invocation:<invocation_id> — so “created by a user” is a question about the type prefix and “created by this user” a question about the whole value. Putting the type in the operator is what lets a filter UI offer the matching directory to pick from, instead of asking for a hand-typed prefix.
Each type contributes two operators (see IDENTITY_OPERATORS_BY_TYPE): a value-bearing IS_<TYPE> and a valueless IS_ANY_<TYPE>.
Separate from FilterOnlyComparator because these are not gaps in the query language. Both halves are expressible as a query today — IS_<TYPE> as EQUALS against each picked principal, IS_ANY_<TYPE> as LIKE '<type>:%' — so they are never removed. They are a filter-control affordance, and they outlive the gap enum.
Attributes
IdentityComparator.IsAnyDevice
IdentityComparator.IsAnyIntegration
IdentityComparator.IsAnyInvocation
IdentityComparator.IsAnyOrg
IdentityComparator.IsAnyUser
IdentityComparator.IsDevice
IdentityComparator.IsIntegration
IdentityComparator.IsInvocation
IdentityComparator.IsOrg
IdentityComparator.IsUser
IdentityFilter
Bases: _FilterBase
A principal-valued field, filtered by principal type.
Audit columns (created_by, modified_by) hold a fully-qualified principal string, so the operator names the type (IdentityComparator) and any values it takes are principals of that type — an IS_USER filter carrying a device: value is rejected, since it records an intent the picker cannot express and a query cannot satisfy.
Values are labeled options rather than bare strings: a principal id is not a name a reader can place, so the directory’s display name is captured alongside it at pick time.
Has no presence axis. Every write path stamps an audit principal, so the column is never null and a null check would be an operator that always answers the same way.
Parameters
data AnyAttributes
IdentityFilter.comparator
IdentityFilter.type
IdentityFilter.values
LabeledOption
Bases: pydantic.BaseModel
One option as it was picked: the value a query is built from, plus what the picker showed.
Both halves are stored because the label cannot be recovered later. An opaque value — user:usr_01J..., a tag id — renders as itself, and resolving it on load would mean a directory lookup per chip, against an org that whoever opens a shared View may not be able to read. Only value ever reaches a query.
Parameters
data AnyAttributes
LabeledOption.label
What the picker displayed when the author chose this option. Display only, never queried.
LabeledOption.model_config
model_config #Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
LabeledOption.value
What the query is built from. A fully-qualified principal, for an identity filter.
MAX_PAGE_SIZE
Maximum allowable page size for search.
METRIC_FIELD_PATTERN
METRIC_FIELD_PREFIX
Prefix distinguishing a user-defined metric from an ordinary numeric property.
Metric filters store the prefixed form so that field means the same thing here as it does in a Condition, and translating a filter into a query copies the field across rather than special-casing it.
MetricFilter
Bases: _FilterBase
Ordering and equality over a user-defined metric.
Numeric in every respect except that field is a metric path. Kept a distinct variant so a client restoring a View knows to reopen the metric picker rather than the property form, which it cannot infer from the field name alone.
Carries the presence pair like any other scalar type. A session may simply have no such metric recorded, and the session query path answers that directly — it maps IS_NULL to a NOT EXISTS over the metrics table.
Parameters
data AnyAttributes
MetricFilter.comparator
comparator Literal[roboto.MetricFilter.type
MetricFilter.unit
The metric’s unit, copied from its definition when the filter was built.
Denormalized for display: the filter chip renders it beside the value (“path_deviation > 1.5 m”) without looking the definition up. None when the definition declares no unit.
Being a copy, it goes stale if the definition’s unit later changes: a saved View renders the unit the filter was built with, not the current one.
MetricFilter.values
NumericFilter
Bases: _FilterBase
Ordering and equality over a numeric property.
Parameters
data AnyAttributes
NumericFilter.comparator
comparator Literal[roboto.NumericFilter.type
NumericFilter.values
QualifiedRoboqlQuery
Bases: pydantic.BaseModel
A RoboQL query which has been qualified with a target.
Parameters
data AnyAttributes
QualifiedRoboqlQuery.query
QualifiedRoboqlQuery.target
Query
QueryClient
A low-level Roboto query client. Prefer RobotoSearch for a simpler, more curated query interface.
Parameters
roboto_client Optional[roboto.owner_org_id Optional[str]roboto_profile Optional[str]QueryClient.are_query_results_available()
Parameters
query_id strowner_org_id Optional[str]Return type
QueryClient.get_query_record()
Parameters
query_id strowner_org_id Optional[str]Return type
QueryClient.get_query_results()
Parameters
query_id strowner_org_id Optional[str]Return type
Properties
QueryClient.roboto_client
QueryClient.submit_query()
Parameters
query Optional[Query]target roboto.timeout_seconds floatcontent_mode roboto.owner_org_id Optional[str]Return type
QueryClient.submit_roboql()
Parameters
owner_org_id Optional[str]Return type
QueryClient.submit_roboql_and_await_results()
Parameters
Return type
QueryClient.submit_structured()
Parameters
owner_org_id Optional[str]Return type
QueryClient.submit_structured_and_await_results()
Parameters
timeout_seconds floatowner_org_id Optional[str]Return type
QueryClient.submit_term()
Parameters
owner_org_id Optional[str]Return type
QueryClient.submit_term_and_await_results()
Parameters
Return type
QueryContentMode
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
Query results are returned with core Roboto data attributes only.
Those attributes establish the identity and function of Roboto entities.
QueryContentMode.RecordWithMeta
Query results are returned with all available entity attributes.
This includes core Roboto data attributes as well as custom metadata.
QueryContext
Bases: pydantic.BaseModel
Context for a query
Parameters
data AnyAttributes
QueryContext.query
QueryContext.query_scheme
QueryRecord
Bases: pydantic.BaseModel
A wire-transmissible representation of a query.
Parameters
data AnyAttributes
QueryRecord.modified
QueryRecord.org_id
QueryRecord.query_ctx
QueryRecord.query_id
QueryRecord.result_count
QueryRecord.status
QueryRecord.submitted
QueryRecord.submitted_by
QueryRecord.target
QueryScheme
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
The initial variant of roboto.query.QuerySpecification which powered search since mid 2023.
QuerySpecification
Bases: pydantic.BaseModel
Model for specifying a query to the Roboto Platform.
Usage
Specify a query with a single condition:
>>> from roboto import query >>> query_spec = query.QuerySpecification( … condition=query.Condition(field=“name”, comparator=query.Comparator.Equals, value=“Roboto”) … )
Specify a query with multiple conditions:
>>> from roboto import query >>> query_spec = query.QuerySpecification( … condition=query.ConditionGroup( … operator=query.ConditionOperator.And, … conditions=[ … query.Condition(field=“name”, comparator=query.Comparator.Equals, value=“Roboto”), … query.Condition(field=“age”, comparator=query.Comparator.GreaterThan, value=18), … ], … ) … )
Arbitrarily nest condition groups:
>>> from roboto import query >>> query_spec = query.QuerySpecification( … condition=query.ConditionGroup( … operator=query.ConditionOperator.And, … conditions=[ … query.Condition(field=“name”, comparator=query.Comparator.Equals, value=“Roboto”), … query.ConditionGroup( … operator=query.ConditionOperator.Or, … conditions=[ … query.Condition(field=“age”, comparator=query.Comparator.GreaterThan, value=18), … query.Condition(field=“age”, comparator=query.Comparator.LessThan, value=30), … ], … ), … ], … ) … )
Parameters
data AnyAttributes
QuerySpecification.condition
condition roboto.Query condition(s) to evaluate when looking up Roboto entities.
QuerySpecification.fields()
Return a set of all fields referenced in the query.
Return type
Attributes
QuerySpecification.limit
Page size for returned results. Optional, default is MAX_PAGE_SIZE.
QuerySpecification.max_results
Maximum number of results to return across all pages. Must be >= 1 when set. None (default) means no cap — pagination yields the full result set. Distinct from limit, which is the per-page size.
Only honored for queries executed via Roboto search (the QueryTarget resource types: collections, datasets, devices, files, sessions, topics, topic message paths, events). Other code paths that accept a QuerySpecification ignore this field.
QuerySpecification.model_config
model_config #Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
QuerySpecification.sort_by
Field to sort results by. Optional, defaults to created date (created).
QuerySpecification.sort_direction
Sort direction for query results. Optional, defaults to “descending”.
QueryStatus
Bases: enum.Enum
The query lifecycle state of a given query.
Attributes
QueryStatus.ResultsAvailable
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.
QueryStorageContext
Bases: pydantic.BaseModel
Context for query storage
Parameters
data AnyAttributes
QueryStorageContext.storage_ctx
QueryStorageContext.storage_scheme
QueryStorageScheme
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
Query results are in S3, and a manifest file enumerates the result parts and how to resolve them into rows.
QueryTarget
Bases: roboto.compat.StrEnum
The type of resource a specific query is requesting.
Attributes
QueryTarget.Collections
QueryTarget.Datasets
QueryTarget.Devices
QueryTarget.Events
QueryTarget.Files
QueryTarget.Sessions
QueryTarget.TopicMessagePaths
QueryTarget.Topics
SavedFilters
Bases: pydantic.BaseModel
A complete set of filter controls, as saved.
Parameters
data AnyAttributes
SavedFilters.match_mode
Whether the rows are combined with AND or OR.
Deliberately a single flag rather than a nested boolean expression. A Condition can express arbitrary nesting, but a filter UI cannot build one legibly, so this records the shape the UI actually offers.
SavedFilters.model_config
model_config #Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
SetFilter
Bases: _FilterBase
Membership in a collection-valued field, such as tags.
Has no presence axis: an empty collection is not the same as an absent one, and the UI offers no null check here.
Parameters
data AnyAttributes
SetFilter.comparator
comparator Literal[roboto.SetFilter.type
SetFilter.values
SortDirection
Bases: roboto.compat.StrEnum
The direction to sort the results of a query.
SortDirection.from_string()
Parameters
value strReturn type
StringFilter
Bases: _FilterBase
Text matching.
Parameters
data AnyAttributes
StringFilter.comparator
comparator Literal[roboto.StringFilter.type
StringFilter.values
SubmitRoboqlQueryRequest
Bases: pydantic.BaseModel
Request payload to submit a RoboQL query
Parameters
data AnyAttributes
SubmitRoboqlQueryRequest.content_mode
SubmitRoboqlQueryRequest.query
SubmitRoboqlQueryRequest.target
SubmitStructuredQueryRequest
Bases: pydantic.BaseModel
Request payload to submit a structured query
Parameters
data AnyAttributes
SubmitStructuredQueryRequest.content_mode
SubmitStructuredQueryRequest.query
SubmitStructuredQueryRequest.target
SubmitTermQueryRequest
Bases: pydantic.BaseModel
Request payload to submit a simple term query
Parameters
data AnyAttributes