roboto.query.client
Module Contents
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()
Yield every result of a query, fetching one page at a time as iteration reaches it.
Parameters
query_id strID 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
Properties
QueryClient.roboto_client
QueryClient.submit_query()
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.
target roboto.The kind of entity to query.
timeout_seconds floatHow long to wait for the query to finish.
content_mode roboto.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
TimeoutErrorResults were not available within timeout_seconds. A query that fails keeps the wait going until the timeout.
Return type
QueryClient.submit_roboql()
Parameters
owner_org_id Optional[str]Return type
QueryClient.submit_roboql_and_await_results()
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 floatHow 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
TimeoutErrorResults were not available within timeout_seconds. A query that fails keeps the wait going until the timeout.
Return type
QueryClient.submit_structured()
Parameters
owner_org_id Optional[str]Return type
QueryClient.submit_structured_and_await_results()
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
The query to submit.
timeout_seconds floatHow 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
TimeoutErrorResults were not available within timeout_seconds. A query that fails keeps the wait going until the timeout.
Return type
QueryClient.submit_term()
Parameters
owner_org_id Optional[str]Return type
QueryClient.submit_term_and_await_results()
Submit a term query, wait for it to finish, and yield its results.
Parameters
The query to submit.
timeout_seconds floatHow 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
TimeoutErrorResults 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