executeQuery method
Run SQL queries to retrieve metadata and time-series data from asset models, assets, measurements, metrics, transforms, and aggregates.
May throw AccessDeniedException.
May throw InternalFailureException.
May throw InvalidRequestException.
May throw QueryTimeoutException.
May throw ServiceUnavailableException.
May throw ThrottlingException.
May throw ValidationException.
Parameter queryStatement :
The IoT SiteWise query statement.
Parameter clientToken :
A unique case-sensitive identifier that you can provide to ensure the
idempotency of the request. Don't reuse this client token if a new
idempotent request is required.
Parameter maxResults :
The maximum number of results to return at one time.
- Minimum is 1
- Maximum is 20000
- Default is 20000
Parameter nextToken :
The string that specifies the next page of results.
Implementation
Future<ExecuteQueryResponse> executeQuery({
required String queryStatement,
String? clientToken,
int? maxResults,
String? nextToken,
}) async {
_s.validateNumRange(
'maxResults',
maxResults,
1,
1152921504606846976,
);
final $payload = <String, dynamic>{
'queryStatement': queryStatement,
'clientToken': clientToken ?? _s.generateIdempotencyToken(),
if (maxResults != null) 'maxResults': maxResults,
if (nextToken != null) 'nextToken': nextToken,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri: '/queries/execution',
exceptionFnMap: _exceptionFns,
);
return ExecuteQueryResponse.fromJson(response);
}