Package com.influxdb.v3.client.query
Class QueryOptions
java.lang.Object
com.influxdb.v3.client.query.QueryOptions
Query API options.
 
Supports to specify:
- database- specifies the database to be used for InfluxDB operations
- queryType- specifies the type of query sent to InfluxDB. Default to 'SQL'.
- headers- specifies the headers to be added to query request
To add custom headers to the query request, use the following code:
 QueryOptions options = new QueryOptions(Map.of("X-Tracing-Id", "123"));
 Stream<Object[]> rows = client.query("select * from cpu", queryOptions);
 - 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final QueryOptionsDeprecated, for removal: This API element is subject to removal in a future version.static final QueryOptionsDeprecated, for removal: This API element is subject to removal in a future version.
- 
Constructor SummaryConstructorsConstructorDescriptionQueryOptions(QueryType queryType) Construct QueryAPI options.QueryOptions(String database) Construct QueryAPI options.QueryOptions(String database, QueryType queryType) Construct QueryAPI options.Construct QueryAPI options.QueryOptions(Map<String, String> headers) Construct QueryAPI options.
- 
Method SummaryModifier and TypeMethodDescriptiondatabaseSafe(ClientConfig config) static QueryOptionsProvides default query options for executing InfluxQL queries with no database specified.static QueryOptionsProvides default query options with no database specified and using SQL as the query type.voidsetGrpcCallOptions(GrpcCallOptions grpcCallOptions) Sets the GrpcCallOptions object.
- 
Field Details- 
DEFAULTSDeprecated, for removal: This API element is subject to removal in a future version.Default QueryAPI options.
 Deprecated: usedefaultQueryOptions()instead.
- 
INFLUX_QLDeprecated, for removal: This API element is subject to removal in a future version.Default QueryAPI options for InfluxQL.
 Deprecated: usedefaultInfluxQlQueryOptions()instead.
 
- 
- 
Constructor Details- 
QueryOptionsConstruct QueryAPI options. The query type is set to SQL.- Parameters:
- database- The database to be used for InfluxDB operations.
 
- 
QueryOptionsConstruct QueryAPI options.- Parameters:
- queryType- The type of query sent to InfluxDB.
 
- 
QueryOptionsConstruct QueryAPI options. The query type is set to SQL.- Parameters:
- headers- The headers to be added to query request. The headers specified here are preferred over the headers specified in the client configuration.
 
- 
QueryOptionsConstruct QueryAPI options.- Parameters:
- database- The database to be used for InfluxDB operations. If it is not specified then use- ClientConfig.getDatabase().
- queryType- The type of query sent to InfluxDB. If it is not specified then use- QueryType.SQL.
 
- 
QueryOptionspublic QueryOptions(@Nullable String database, @Nullable QueryType queryType, @Nullable Map<String, String> headers) Construct QueryAPI options.- Parameters:
- database- The database to be used for InfluxDB operations. If it is not specified then use- ClientConfig.getDatabase().
- queryType- The type of query sent to InfluxDB. If it is not specified then use- QueryType.SQL.
- headers- The headers to be added to query request. The headers specified here are preferred over the headers specified in the client configuration.
 
 
- 
- 
Method Details- 
defaultQueryOptionsProvides default query options with no database specified and using SQL as the query type.- Returns:
- A QueryOptionsinstance with default settings, including a null database andQueryType.SQLas the query type.
 
- 
defaultInfluxQlQueryOptionsProvides default query options for executing InfluxQL queries with no database specified.- Returns:
- A QueryOptionsinstance configured with a null database andQueryType.InfluxQL.
 
- 
databaseSafe- Parameters:
- config- with default value
- Returns:
- The destination database for writes.
 
- 
queryTypeSafe- Returns:
- The type of query sent to InfluxDB, cannot be null.
 
- 
headersSafe- Returns:
- The headers to be added to query request, cannot be null.
 
- 
setGrpcCallOptionsSets the GrpcCallOptions object.- Parameters:
- grpcCallOptions- the grpcCallOptions
 
- 
grpcCallOptions- Returns:
- the GrpcCallOptions object.
 
 
-