executeSqlQuery method

Future<ExecuteSqlQueryResponse> executeSqlQuery(
  1. ExecuteSqlQueryRequest request,
  2. String connection, {
  3. String? $fields,
})

Executes a SQL statement specified in the body of the request.

An example of this SQL statement in the case of Salesforce connector would be 'select * from Account a, Order o where a.Id = o.AccountId'.

request - The metadata request object.

Request parameters:

connection - Required. Resource name of the Connection. Format: projects/{project}/locations/{location}/connections/{connection} Value must have pattern ^projects/\[^/\]+/locations/\[^/\]+/connections/\[^/\]+$.

$fields - Selector specifying which fields to include in a partial response.

Completes with a ExecuteSqlQueryResponse.

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<ExecuteSqlQueryResponse> executeSqlQuery(
  ExecuteSqlQueryRequest request,
  core.String connection, {
  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_ =
      'v2/' + core.Uri.encodeFull('$connection') + ':executeSqlQuery';

  final response_ = await _requester.request(
    url_,
    'POST',
    body: body_,
    queryParams: queryParams_,
  );
  return ExecuteSqlQueryResponse.fromJson(
      response_ as core.Map<core.String, core.dynamic>);
}