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

roboto.query.client

Module Contents

Query

type roboto.query.client.Query = typing.Union[RoboQLQuery, QuerySpecification]#View Source

QueryClient

class roboto.query.client.QueryClient(roboto_client=None, owner_org_id=None, roboto_profile=None)#View Source

A low-level Roboto query client. Prefer RobotoSearch for a simpler, more curated query interface.

Parameters

roboto_client Optional[roboto.http.RobotoClient]
owner_org_id Optional[str]
roboto_profile Optional[str]

QueryClient.are_query_results_available()

are_query_results_available(query_id, owner_org_id=None)#View Source

Parameters

query_id str
owner_org_id Optional[str]

Return type

bool

QueryClient.get_query_record()

get_query_record(query_id, owner_org_id=None)#View Source

Parameters

query_id str
owner_org_id Optional[str]

QueryClient.get_query_results()

get_query_results(query_id, owner_org_id=None, page_size=None)#View Source

Yield every result of a query, fetching one page at a time as iteration reaches it.

Parameters

query_id str

ID of a query whose results are available.

owner_org_id Optional[str]

Organization that owns the query. Defaults to this client’s organization.

page_size Optional[int]

Number of results to fetch per page, from 1 to MAX_PAGE_SIZE. Defaults to DEFAULT_PAGE_SIZE.

Yields

Each result record, in the query’s sort order.

Raises

page_size is outside 1 to MAX_PAGE_SIZE. Raised when iteration requests the first page, not when this method is called.

Return type

collections.abc.Generator[dict[str, Any], None, None]

Properties

QueryClient.roboto_client

QueryClient.submit_query()

submit_query(query, target, timeout_seconds, content_mode=QueryContentMode.RecordWithMeta, owner_org_id=None)#View Source

Submit a RoboQL or structured query, wait for it to finish, and yield its results.

To cap the total number of results, set max_results on a QuerySpecification, or add LIMIT N to a RoboQL query.

Parameters

query Optional[Query]

A RoboQL string or a QuerySpecification. None matches everything in target.

The kind of entity to query.

timeout_seconds float

How long to wait for the query to finish.

Whether results include custom metadata. See QueryContentMode.

owner_org_id Optional[str]

Organization to run the query in. Defaults to this client’s organization.

Yields

Each result record, in the query’s sort order.

Raises

TimeoutError

Results were not available within timeout_seconds. A query that fails keeps the wait going until the timeout.

Return type

collections.abc.Generator[dict[str, Any], None, None]

QueryClient.submit_roboql()

submit_roboql(request, owner_org_id=None)#View Source

Parameters

owner_org_id Optional[str]

QueryClient.submit_roboql_and_await_results()

submit_roboql_and_await_results(request, timeout_seconds, owner_org_id=None)#View Source

Submit a RoboQL query, wait for it to finish, and yield its results.

To cap the total number of results, add LIMIT N to the query.

Parameters

The query to submit.

timeout_seconds float

How long to wait for the query to finish.

owner_org_id Optional[str]

Organization to run the query in. Defaults to this client’s organization.

Yields

Each result record, in the query’s sort order.

Raises

TimeoutError

Results were not available within timeout_seconds. A query that fails keeps the wait going until the timeout.

Return type

collections.abc.Generator[dict[str, Any], None, None]

QueryClient.submit_structured()

submit_structured(request, owner_org_id=None)#View Source

Parameters

owner_org_id Optional[str]

QueryClient.submit_structured_and_await_results()

submit_structured_and_await_results(request, timeout_seconds, owner_org_id=None)#View Source

Submit a structured query, wait for it to finish, and yield its results.

To cap the total number of results, set max_results on the query specification.

Parameters

timeout_seconds float

How long to wait for the query to finish.

owner_org_id Optional[str]

Organization to run the query in. Defaults to this client’s organization.

Yields

Each result record, in the query’s sort order.

Raises

TimeoutError

Results were not available within timeout_seconds. A query that fails keeps the wait going until the timeout.

Return type

collections.abc.Generator[dict[str, Any], None, None]

QueryClient.submit_term()

submit_term(request, owner_org_id=None)#View Source

Parameters

owner_org_id Optional[str]

QueryClient.submit_term_and_await_results()

submit_term_and_await_results(request, timeout_seconds=math.inf, owner_org_id=None)#View Source

Submit a term query, wait for it to finish, and yield its results.

Parameters

The query to submit.

timeout_seconds float

How long to wait for the query to finish. Defaults to waiting indefinitely.

owner_org_id Optional[str]

Organization to run the query in. Defaults to this client’s organization.

Yields

Each result record, in the query’s sort order.

Raises

TimeoutError

Results were not available within timeout_seconds. A query that fails keeps the wait going until the timeout, so with the default timeout_seconds it never returns.

Return type

collections.abc.Generator[dict[str, Any], None, None]

RoboQLQuery

type roboto.query.client.RoboQLQuery = str#View Source

Was this page helpful?