partitionQuery method
- PartitionQueryRequest request,
- String session, {
- String? $fields,
Creates a set of partition tokens that can be used to execute a query operation in parallel.
Each of the returned partition tokens can be used by ExecuteStreamingSql
to specify a subset of the query result to read. The same session and
read-only transaction must be used by the PartitionQueryRequest
used to
create the partition tokens and the ExecuteSqlRequests
that use the
partition tokens. Partition tokens become invalid when the session used to
create them is deleted, is idle for too long, begins a new transaction, or
becomes too old. When any of these happen, it isn't possible to resume the
query, and the whole operation must be restarted from the beginning.
request
- The metadata request object.
Request parameters:
session
- Required. The session used to create the partitions.
Value must have pattern
^projects/\[^/\]+/instances/\[^/\]+/databases/\[^/\]+/sessions/\[^/\]+$
.
$fields
- Selector specifying which fields to include in a partial
response.
Completes with a PartitionResponse.
Completes with a commons.ApiRequestError if the API endpoint returned an error.
If the used http.Client
completes with an error when making a REST call,
this method will complete with the same error.
Implementation
async.Future<PartitionResponse> partitionQuery(
PartitionQueryRequest request,
core.String session, {
core.String? $fields,
}) async {
final body_ = convert.json.encode(request);
final queryParams_ = <core.String, core.List<core.String>>{
if ($fields != null) 'fields': [$fields],
};
final url_ = 'v1/' + core.Uri.encodeFull('$session') + ':partitionQuery';
final response_ = await _requester.request(
url_,
'POST',
body: body_,
queryParams: queryParams_,
);
return PartitionResponse.fromJson(
response_ as core.Map<core.String, core.dynamic>,
);
}