target.apidocs.com.google.api.services.bigquery.model.QueryRequest.html Maven / Gradle / Ivy
QueryRequest (BigQuery API v2-rev20220422-1.32.1)
com.google.api.services.bigquery.model
Class QueryRequest
- java.lang.Object
-
- java.util.AbstractMap<String,Object>
-
- com.google.api.client.util.GenericData
-
- com.google.api.client.json.GenericJson
-
- com.google.api.services.bigquery.model.QueryRequest
-
public final class QueryRequest
extends GenericJson
Model definition for QueryRequest.
This is the Java data model class that specifies how to parse/serialize into the JSON that is
transmitted over HTTP when working with the BigQuery API. For a detailed explanation see:
https://developers.google.com/api-client-library/java/google-http-java-client/json
- Author:
- Google, Inc.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.google.api.client.util.GenericData
GenericData.Flags
-
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
-
Constructor Summary
Constructors
Constructor and Description
QueryRequest()
-
Method Summary
All Methods Instance Methods Concrete Methods
Modifier and Type
Method and Description
QueryRequest
clone()
List<ConnectionProperty>
getConnectionProperties()
Connection properties.
Boolean
getCreateSession()
If true, creates a new session, where session id will be a server generated random id.
DatasetReference
getDefaultDataset()
[Optional] Specifies the default datasetId and projectId to assume for any unqualified table
names in the query.
Boolean
getDryRun()
[Optional] If set to true, BigQuery doesn't run the job.
String
getKind()
The resource type of the request.
Map<String,String>
getLabels()
The labels associated with this job.
String
getLocation()
The geographic location where the job should run.
Long
getMaximumBytesBilled()
[Optional] Limits the bytes billed for this job.
Long
getMaxResults()
[Optional] The maximum number of rows of data to return per page of results.
String
getParameterMode()
Standard SQL only.
Boolean
getPreserveNulls()
[Deprecated] This property is deprecated.
String
getQuery()
[Required] A query string, following the BigQuery query syntax, of the query to execute.
List<QueryParameter>
getQueryParameters()
Query parameters for Standard SQL queries.
String
getRequestId()
A unique user provided identifier to ensure idempotent behavior for queries.
Long
getTimeoutMs()
[Optional] How long to wait for the query to complete, in milliseconds, before the request
times out and returns.
Boolean
getUseLegacySql()
Specifies whether to use BigQuery's legacy SQL dialect for this query.
Boolean
getUseQueryCache()
[Optional] Whether to look for the result in the query cache.
boolean
isUseLegacySql()
Convenience method that returns only Boolean.TRUE
or Boolean.FALSE
.
boolean
isUseQueryCache()
Convenience method that returns only Boolean.TRUE
or Boolean.FALSE
.
QueryRequest
set(String fieldName,
Object value)
QueryRequest
setConnectionProperties(List<ConnectionProperty> connectionProperties)
Connection properties.
QueryRequest
setCreateSession(Boolean createSession)
If true, creates a new session, where session id will be a server generated random id.
QueryRequest
setDefaultDataset(DatasetReference defaultDataset)
[Optional] Specifies the default datasetId and projectId to assume for any unqualified table
names in the query.
QueryRequest
setDryRun(Boolean dryRun)
[Optional] If set to true, BigQuery doesn't run the job.
QueryRequest
setKind(String kind)
The resource type of the request.
QueryRequest
setLabels(Map<String,String> labels)
The labels associated with this job.
QueryRequest
setLocation(String location)
The geographic location where the job should run.
QueryRequest
setMaximumBytesBilled(Long maximumBytesBilled)
[Optional] Limits the bytes billed for this job.
QueryRequest
setMaxResults(Long maxResults)
[Optional] The maximum number of rows of data to return per page of results.
QueryRequest
setParameterMode(String parameterMode)
Standard SQL only.
QueryRequest
setPreserveNulls(Boolean preserveNulls)
[Deprecated] This property is deprecated.
QueryRequest
setQuery(String query)
[Required] A query string, following the BigQuery query syntax, of the query to execute.
QueryRequest
setQueryParameters(List<QueryParameter> queryParameters)
Query parameters for Standard SQL queries.
QueryRequest
setRequestId(String requestId)
A unique user provided identifier to ensure idempotent behavior for queries.
QueryRequest
setTimeoutMs(Long timeoutMs)
[Optional] How long to wait for the query to complete, in milliseconds, before the request
times out and returns.
QueryRequest
setUseLegacySql(Boolean useLegacySql)
Specifies whether to use BigQuery's legacy SQL dialect for this query.
QueryRequest
setUseQueryCache(Boolean useQueryCache)
[Optional] Whether to look for the result in the query cache.
-
Methods inherited from class com.google.api.client.json.GenericJson
getFactory, setFactory, toPrettyString, toString
-
Methods inherited from class com.google.api.client.util.GenericData
entrySet, equals, get, getClassInfo, getUnknownKeys, hashCode, put, putAll, remove, setUnknownKeys
-
Methods inherited from class java.util.AbstractMap
clear, containsKey, containsValue, isEmpty, keySet, size, values
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
-
Method Detail
-
getConnectionProperties
public List<ConnectionProperty> getConnectionProperties()
Connection properties.
- Returns:
- value or
null
for none
-
setConnectionProperties
public QueryRequest setConnectionProperties(List<ConnectionProperty> connectionProperties)
Connection properties.
- Parameters:
connectionProperties
- connectionProperties or null
for none
-
getCreateSession
public Boolean getCreateSession()
If true, creates a new session, where session id will be a server generated random id. If
false, runs query with an existing session_id passed in ConnectionProperty, otherwise runs
query in non-session mode.
- Returns:
- value or
null
for none
-
setCreateSession
public QueryRequest setCreateSession(Boolean createSession)
If true, creates a new session, where session id will be a server generated random id. If
false, runs query with an existing session_id passed in ConnectionProperty, otherwise runs
query in non-session mode.
- Parameters:
createSession
- createSession or null
for none
-
getDefaultDataset
public DatasetReference getDefaultDataset()
[Optional] Specifies the default datasetId and projectId to assume for any unqualified table
names in the query. If not set, all table names in the query string must be qualified in the
format 'datasetId.tableId'.
- Returns:
- value or
null
for none
-
setDefaultDataset
public QueryRequest setDefaultDataset(DatasetReference defaultDataset)
[Optional] Specifies the default datasetId and projectId to assume for any unqualified table
names in the query. If not set, all table names in the query string must be qualified in the
format 'datasetId.tableId'.
- Parameters:
defaultDataset
- defaultDataset or null
for none
-
getDryRun
public Boolean getDryRun()
[Optional] If set to true, BigQuery doesn't run the job. Instead, if the query is valid,
BigQuery returns statistics about the job such as how many bytes would be processed. If the
query is invalid, an error returns. The default value is false.
- Returns:
- value or
null
for none
-
setDryRun
public QueryRequest setDryRun(Boolean dryRun)
[Optional] If set to true, BigQuery doesn't run the job. Instead, if the query is valid,
BigQuery returns statistics about the job such as how many bytes would be processed. If the
query is invalid, an error returns. The default value is false.
- Parameters:
dryRun
- dryRun or null
for none
-
getKind
public String getKind()
The resource type of the request.
- Returns:
- value or
null
for none
-
setKind
public QueryRequest setKind(String kind)
The resource type of the request.
- Parameters:
kind
- kind or null
for none
-
getLabels
public Map<String,String> getLabels()
The labels associated with this job. You can use these to organize and group your jobs. Label
keys and values can be no longer than 63 characters, can only contain lowercase letters,
numeric characters, underscores and dashes. International characters are allowed. Label values
are optional. Label keys must start with a letter and each label in the list must have a
different key.
- Returns:
- value or
null
for none
-
setLabels
public QueryRequest setLabels(Map<String,String> labels)
The labels associated with this job. You can use these to organize and group your jobs. Label
keys and values can be no longer than 63 characters, can only contain lowercase letters,
numeric characters, underscores and dashes. International characters are allowed. Label values
are optional. Label keys must start with a letter and each label in the list must have a
different key.
- Parameters:
labels
- labels or null
for none
-
getLocation
public String getLocation()
The geographic location where the job should run. See details at
https://cloud.google.com/bigquery/docs/locations#specifying_your_location.
- Returns:
- value or
null
for none
-
setLocation
public QueryRequest setLocation(String location)
The geographic location where the job should run. See details at
https://cloud.google.com/bigquery/docs/locations#specifying_your_location.
- Parameters:
location
- location or null
for none
-
getMaxResults
public Long getMaxResults()
[Optional] The maximum number of rows of data to return per page of results. Setting this flag
to a small value such as 1000 and then paging through results might improve reliability when
the query result set is large. In addition to this limit, responses are also limited to 10 MB.
By default, there is no maximum row count, and only the byte limit applies.
- Returns:
- value or
null
for none
-
setMaxResults
public QueryRequest setMaxResults(Long maxResults)
[Optional] The maximum number of rows of data to return per page of results. Setting this flag
to a small value such as 1000 and then paging through results might improve reliability when
the query result set is large. In addition to this limit, responses are also limited to 10 MB.
By default, there is no maximum row count, and only the byte limit applies.
- Parameters:
maxResults
- maxResults or null
for none
-
getMaximumBytesBilled
public Long getMaximumBytesBilled()
[Optional] Limits the bytes billed for this job. Queries that will have bytes billed beyond
this limit will fail (without incurring a charge). If unspecified, this will be set to your
project default.
- Returns:
- value or
null
for none
-
setMaximumBytesBilled
public QueryRequest setMaximumBytesBilled(Long maximumBytesBilled)
[Optional] Limits the bytes billed for this job. Queries that will have bytes billed beyond
this limit will fail (without incurring a charge). If unspecified, this will be set to your
project default.
- Parameters:
maximumBytesBilled
- maximumBytesBilled or null
for none
-
getParameterMode
public String getParameterMode()
Standard SQL only. Set to POSITIONAL to use positional (?) query parameters or to NAMED to use
named (@myparam) query parameters in this query.
- Returns:
- value or
null
for none
-
setParameterMode
public QueryRequest setParameterMode(String parameterMode)
Standard SQL only. Set to POSITIONAL to use positional (?) query parameters or to NAMED to use
named (@myparam) query parameters in this query.
- Parameters:
parameterMode
- parameterMode or null
for none
-
getPreserveNulls
public Boolean getPreserveNulls()
[Deprecated] This property is deprecated.
- Returns:
- value or
null
for none
-
setPreserveNulls
public QueryRequest setPreserveNulls(Boolean preserveNulls)
[Deprecated] This property is deprecated.
- Parameters:
preserveNulls
- preserveNulls or null
for none
-
getQuery
public String getQuery()
[Required] A query string, following the BigQuery query syntax, of the query to execute.
Example: "SELECT count(f1) FROM [myProjectId:myDatasetId.myTableId]".
- Returns:
- value or
null
for none
-
setQuery
public QueryRequest setQuery(String query)
[Required] A query string, following the BigQuery query syntax, of the query to execute.
Example: "SELECT count(f1) FROM [myProjectId:myDatasetId.myTableId]".
- Parameters:
query
- query or null
for none
-
getQueryParameters
public List<QueryParameter> getQueryParameters()
Query parameters for Standard SQL queries.
- Returns:
- value or
null
for none
-
setQueryParameters
public QueryRequest setQueryParameters(List<QueryParameter> queryParameters)
Query parameters for Standard SQL queries.
- Parameters:
queryParameters
- queryParameters or null
for none
-
getRequestId
public String getRequestId()
A unique user provided identifier to ensure idempotent behavior for queries. Note that this is
different from the job_id. It has the following properties: 1. It is case-sensitive, limited to
up to 36 ASCII characters. A UUID is recommended. 2. Read only queries can ignore this token
since they are nullipotent by definition. 3. For the purposes of idempotency ensured by the
request_id, a request is considered duplicate of another only if they have the same request_id
and are actually duplicates. When determining whether a request is a duplicate of the previous
request, all parameters in the request that may affect the behavior are considered. For
example, query, connection_properties, query_parameters, use_legacy_sql are parameters that
affect the result and are considered when determining whether a request is a duplicate, but
properties like timeout_ms don't affect the result and are thus not considered. Dry run query
requests are never considered duplicate of another request. 4. When a duplicate mutating query
request is detected, it returns: a. the results of the mutation if it completes successfully
within the timeout. b. the running operation if it is still in progress at the end of the
timeout. 5. Its lifetime is limited to 15 minutes. In other words, if two requests are sent
with the same request_id, but more than 15 minutes apart, idempotency is not guaranteed.
- Returns:
- value or
null
for none
-
setRequestId
public QueryRequest setRequestId(String requestId)
A unique user provided identifier to ensure idempotent behavior for queries. Note that this is
different from the job_id. It has the following properties: 1. It is case-sensitive, limited to
up to 36 ASCII characters. A UUID is recommended. 2. Read only queries can ignore this token
since they are nullipotent by definition. 3. For the purposes of idempotency ensured by the
request_id, a request is considered duplicate of another only if they have the same request_id
and are actually duplicates. When determining whether a request is a duplicate of the previous
request, all parameters in the request that may affect the behavior are considered. For
example, query, connection_properties, query_parameters, use_legacy_sql are parameters that
affect the result and are considered when determining whether a request is a duplicate, but
properties like timeout_ms don't affect the result and are thus not considered. Dry run query
requests are never considered duplicate of another request. 4. When a duplicate mutating query
request is detected, it returns: a. the results of the mutation if it completes successfully
within the timeout. b. the running operation if it is still in progress at the end of the
timeout. 5. Its lifetime is limited to 15 minutes. In other words, if two requests are sent
with the same request_id, but more than 15 minutes apart, idempotency is not guaranteed.
- Parameters:
requestId
- requestId or null
for none
-
getTimeoutMs
public Long getTimeoutMs()
[Optional] How long to wait for the query to complete, in milliseconds, before the request
times out and returns. Note that this is only a timeout for the request, not the query. If the
query takes longer to run than the timeout value, the call returns without any results and with
the 'jobComplete' flag set to false. You can call GetQueryResults() to wait for the query to
complete and read the results. The default value is 10000 milliseconds (10 seconds).
- Returns:
- value or
null
for none
-
setTimeoutMs
public QueryRequest setTimeoutMs(Long timeoutMs)
[Optional] How long to wait for the query to complete, in milliseconds, before the request
times out and returns. Note that this is only a timeout for the request, not the query. If the
query takes longer to run than the timeout value, the call returns without any results and with
the 'jobComplete' flag set to false. You can call GetQueryResults() to wait for the query to
complete and read the results. The default value is 10000 milliseconds (10 seconds).
- Parameters:
timeoutMs
- timeoutMs or null
for none
-
getUseLegacySql
public Boolean getUseLegacySql()
Specifies whether to use BigQuery's legacy SQL dialect for this query. The default value is
true. If set to false, the query will use BigQuery's standard SQL:
https://cloud.google.com/bigquery/sql-reference/ When useLegacySql is set to false, the value
of flattenResults is ignored; query will be run as if flattenResults is false.
- Returns:
- value or
null
for none
-
setUseLegacySql
public QueryRequest setUseLegacySql(Boolean useLegacySql)
Specifies whether to use BigQuery's legacy SQL dialect for this query. The default value is
true. If set to false, the query will use BigQuery's standard SQL:
https://cloud.google.com/bigquery/sql-reference/ When useLegacySql is set to false, the value
of flattenResults is ignored; query will be run as if flattenResults is false.
- Parameters:
useLegacySql
- useLegacySql or null
for none
-
isUseLegacySql
public boolean isUseLegacySql()
Convenience method that returns only Boolean.TRUE
or Boolean.FALSE
.
Boolean properties can have four possible values:
null
, Data.NULL_BOOLEAN
, Boolean.TRUE
or Boolean.FALSE
.
This method returns Boolean.TRUE
if the default of the property is Boolean.TRUE
and it is null
or Data.NULL_BOOLEAN
.
Boolean.FALSE
is returned if the default of the property is Boolean.FALSE
and
it is null
or Data.NULL_BOOLEAN
.
Specifies whether to use BigQuery's legacy SQL dialect for this query. The default value is true.
If set to false, the query will use BigQuery's standard SQL: https://cloud.google.com/bigquery/sql-
reference/ When useLegacySql is set to false, the value of flattenResults is ignored; query will be
run as if flattenResults is false.
-
getUseQueryCache
public Boolean getUseQueryCache()
[Optional] Whether to look for the result in the query cache. The query cache is a best-effort
cache that will be flushed whenever tables in the query are modified. The default value is
true.
- Returns:
- value or
null
for none
-
setUseQueryCache
public QueryRequest setUseQueryCache(Boolean useQueryCache)
[Optional] Whether to look for the result in the query cache. The query cache is a best-effort
cache that will be flushed whenever tables in the query are modified. The default value is
true.
- Parameters:
useQueryCache
- useQueryCache or null
for none
-
isUseQueryCache
public boolean isUseQueryCache()
Convenience method that returns only Boolean.TRUE
or Boolean.FALSE
.
Boolean properties can have four possible values:
null
, Data.NULL_BOOLEAN
, Boolean.TRUE
or Boolean.FALSE
.
This method returns Boolean.TRUE
if the default of the property is Boolean.TRUE
and it is null
or Data.NULL_BOOLEAN
.
Boolean.FALSE
is returned if the default of the property is Boolean.FALSE
and
it is null
or Data.NULL_BOOLEAN
.
[ Optional] Whether to look for the result in the query cache. The query cache is a best-effort
[ cache that will be flushed whenever tables in the query are modified. The default value is true.
-
set
public QueryRequest set(String fieldName,
Object value)
- Overrides:
set
in class GenericJson
-
clone
public QueryRequest clone()
- Overrides:
clone
in class GenericJson
Copyright © 2011–2022 Google. All rights reserved.