query method
Runs a BigQuery SQL query synchronously and returns query results if the query completes within a specified timeout.
IAM Permissions Requires the bigquery.jobs.create permission on the
project resource. Data-level permissions are highly dependent on the SQL
statement being executed. While standard queries require data access (such
as bigquery.tables.getData), complex operations like DDL or DCL may
require permissions to manage reservations, IAM policies, or project
settings.
request - The metadata request object.
Request parameters:
projectId - Required. Project ID of the query request.
Value must have pattern ^\[^/\]+$.
$fields - Selector specifying which fields to include in a partial
response.
Completes with a QueryResponse.
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<QueryResponse> query(
QueryRequest request,
core.String projectId, {
core.String? $fields,
}) async {
final body_ = convert.json.encode(request);
final queryParams_ = <core.String, core.List<core.String>>{
'fields': ?$fields == null ? null : [$fields],
};
final url_ = 'projects/' + core.Uri.encodeFull('$projectId') + '/queries';
final response_ = await _requester.request(
url_,
'POST',
body: body_,
queryParams: queryParams_,
);
return QueryResponse.fromJson(
response_ as core.Map<core.String, core.dynamic>,
);
}