Interface InfluxDBClient
- All Superinterfaces:
- AutoCloseable
- All Known Implementing Classes:
- InfluxDBClientImpl
- 
Method SummaryModifier and TypeMethodDescriptionstatic InfluxDBClientCreates a new instance of theInfluxDBClientfrom environment variables and/or system properties.static InfluxDBClientgetInstance(ClientConfig config) Creates a new instance of theInfluxDBClientfor interacting with an InfluxDB server, simplifying common operations such as writing, querying.static InfluxDBClientgetInstance(String connectionString) Creates a new instance of theInfluxDBClientfrom the connection string in URL format.static InfluxDBClientgetInstance(String host, char[] token, String database) Creates a new instance of theInfluxDBClientfor interacting with an InfluxDB server, simplifying common operations such as writing, querying.static InfluxDBClientCreates a new instance of theInfluxDBClientfor interacting with an InfluxDB server, simplifying common operations such as writing, querying.Get InfluxDB server version.Query data from InfluxDB IOx using FlightSQL.query(String query, QueryOptions options) Query data from InfluxDB IOx using FlightSQL.Query data from InfluxDB IOx using FlightSQL.Query data from InfluxDB IOx using FlightSQL.Stream<org.apache.arrow.vector.VectorSchemaRoot>queryBatches(String query) Query data from InfluxDB IOx using FlightSQL.Stream<org.apache.arrow.vector.VectorSchemaRoot>queryBatches(String query, QueryOptions options) Query data from InfluxDB IOx using FlightSQL.Stream<org.apache.arrow.vector.VectorSchemaRoot>queryBatches(String query, Map<String, Object> parameters) Query data from InfluxDB IOx using FlightSQL.Stream<org.apache.arrow.vector.VectorSchemaRoot>queryBatches(String query, Map<String, Object> parameters, QueryOptions options) Query data from InfluxDB IOx using FlightSQL.queryPoints(String query) Query data from InfluxDB IOx into Point structure using FlightSQL.queryPoints(String query, QueryOptions options) Query data from InfluxDB IOx into Point structure using FlightSQL.queryPoints(String query, Map<String, Object> parameters) Query data from InfluxDB IOx into Point structure using FlightSQL.queryPoints(String query, Map<String, Object> parameters, QueryOptions options) Query data from InfluxDB IOx into Point structure using FlightSQL.Query data from InfluxDB IOx using FlightSQL.queryRows(String query, QueryOptions options) Query data from InfluxDB IOx using FlightSQL.Query data from InfluxDB IOx using FlightSQL.Query data from InfluxDB IOx using FlightSQL.voidwritePoint(Point point) Write aPointto the InfluxDB server.voidwritePoint(Point point, WriteOptions options) Write aPointto the InfluxDB server.voidwritePoints(List<Point> points) Write a list ofPointto the InfluxDB server.voidwritePoints(List<Point> points, WriteOptions options) Write a list ofPointto the InfluxDB server.voidwriteRecord(String record) Write a record specified in the InfluxDB Line Protocol to the InfluxDB server.voidwriteRecord(String record, WriteOptions options) Write a record specified in the InfluxDB Line Protocol to the InfluxDB server.voidwriteRecords(List<String> records) Write records specified in the InfluxDB Line Protocol to the InfluxDB server.voidwriteRecords(List<String> records, WriteOptions options) Write records specified in the InfluxDB Line Protocol to the InfluxDB server.Methods inherited from interface java.lang.AutoCloseableclose
- 
Method Details- 
writeRecordWrite a record specified in the InfluxDB Line Protocol to the InfluxDB server.- Parameters:
- record- the record specified in the InfluxDB Line Protocol, can be null
 
- 
writeRecordWrite a record specified in the InfluxDB Line Protocol to the InfluxDB server.- Parameters:
- record- the record specified in the InfluxDB Line Protocol, can be null
- options- the options for writing data to InfluxDB
 
- 
writeRecordsWrite records specified in the InfluxDB Line Protocol to the InfluxDB server.- Parameters:
- records- the records specified in the InfluxDB Line Protocol, cannot be null
 
- 
writeRecordsWrite records specified in the InfluxDB Line Protocol to the InfluxDB server.- Parameters:
- records- the records specified in the InfluxDB Line Protocol, cannot be null
- options- the options for writing data to InfluxDB
 
- 
writePointWrite aPointto the InfluxDB server.- Parameters:
- point- the- Pointto write, can be null- Note: the timestamp passed will be converted to nanoseconds since the Unix epoch by NanosecondConverter helper class 
 
- 
writePointWrite aPointto the InfluxDB server.- Parameters:
- point- the- Pointto write, can be null
- options- the options for writing data to InfluxDB- Note: the timestamp passed will be converted to nanoseconds since the Unix epoch by NanosecondConverter helper class 
 
- 
writePointsWrite a list ofPointto the InfluxDB server.- Parameters:
- points- the list of- Pointto write, cannot be null- Note: the timestamp passed will be converted to nanoseconds since the Unix epoch by NanosecondConverter helper class 
 
- 
writePointsWrite a list ofPointto the InfluxDB server.- Parameters:
- points- the list of- Pointto write, cannot be null
- options- the options for writing data to InfluxDB- Note: the timestamp passed will be converted to nanoseconds since the Unix epoch by NanosecondConverter helper class 
 
- 
queryQuery data from InfluxDB IOx using FlightSQL.The result stream should be closed after use, you can use try-resource pattern to close it automatically: try (Stream<Object[]> rows = client.query("select * from cpu")) { rows.forEach(row -> { // process row } });- Parameters:
- query- the SQL query string to execute, cannot be null
- Returns:
- Batches of rows returned by the query
 Note: the timestamp will be returned as a number of nanoseconds since the Unix epoch 
 
- 
queryQuery data from InfluxDB IOx using FlightSQL.The result stream should be closed after use, you can use try-resource pattern to close it automatically: try (Stream<Object[]> rows = client.query("select * from cpu where host=$host", Map.of("host", "server-a")) { rows.forEach(row -> { // process row } });- Parameters:
- query- the SQL query string to execute, cannot be null
- parameters- query named parameters
- Returns:
- Batches of rows returned by the query
 Note: the timestamp will be returned as a number of nanoseconds since the Unix epoch 
 
- 
queryQuery data from InfluxDB IOx using FlightSQL.The result stream should be closed after use, you can use try-resource pattern to close it automatically: try (Stream<Object[]> rows = client.query("select * from cpu", options)) { rows.forEach(row -> { // process row } });- Parameters:
- query- the query string to execute, cannot be null
- options- the options for querying data from InfluxDB
- Returns:
- Batches of rows returned by the query
 Note: the timestamp will be returned as a number of nanoseconds since the Unix epoch 
 
- 
query@Nonnull Stream<Object[]> query(@Nonnull String query, @Nonnull Map<String, Object> parameters, @Nonnull QueryOptions options) Query data from InfluxDB IOx using FlightSQL.The result stream should be closed after use, you can use try-resource pattern to close it automatically: try (Stream<Object[]> rows = client.query("select * from cpu where host=$host", Map.of("host", "server-a"), options)) { rows.forEach(row -> { // process row } });- Parameters:
- query- the query string to execute, cannot be null
- parameters- query named parameters
- options- the options for querying data from InfluxDB
- Returns:
- Batches of rows returned by the query
 Note: the timestamp will be returned as a number of nanoseconds since the Unix epoch 
 
- 
queryRowsQuery data from InfluxDB IOx using FlightSQL.The result stream should be closed after use, you can use try-resource pattern to close it automatically: try (Stream<Map<String, Object>> rows = client.queryRows("select * from cpu where host=intel")) { rows.forEach(row -> { // process row }); };- Parameters:
- query- the query string to execute, cannot be null
- Returns:
- Batches of rows returned by the query
 
- 
queryRows@Nonnull Stream<Map<String,Object>> queryRows(@Nonnull String query, @Nonnull Map<String, Object> parameters) Query data from InfluxDB IOx using FlightSQL.The result stream should be closed after use, you can use try-resource pattern to close it automatically: try (Stream<Map<String, Object>> rows = client.queryRows("select * from cpu where host=$host", Map.of("host", "server-a"))) { rows.forEach(row -> { // process row }) };- Parameters:
- query- the query string to execute, cannot be null
- parameters- query named parameters
- Returns:
- Batches of rows returned by the query
 
- 
queryRowsQuery data from InfluxDB IOx using FlightSQL.The result stream should be closed after use, you can use try-resource pattern to close it automatically: try (Stream<Map<String, Object>> rows = client.queryRows("select * from cpu where host=intel", options)) { rows.forEach(row -> { // process row }) };- Parameters:
- query- the query string to execute, cannot be null
- options- the options for querying data from InfluxDB
- Returns:
- Batches of rows returned by the query
 
- 
queryRows@Nonnull Stream<Map<String,Object>> queryRows(@Nonnull String query, @Nonnull Map<String, Object> parameters, @Nonnull QueryOptions options) Query data from InfluxDB IOx using FlightSQL.The result stream should be closed after use, you can use try-resource pattern to close it automatically: try (Stream<Map<String, Object>> rows = client.queryRows("select * from cpu where host=$host", Map.of("host", "server-a"), options)) { rows.forEach(row -> { // process row }) };- Parameters:
- query- the query string to execute, cannot be null
- parameters- query named parameters
- options- the options for querying data from InfluxDB
- Returns:
- Batches of rows returned by the query
 
- 
queryPointsQuery data from InfluxDB IOx into Point structure using FlightSQL.The result stream should be closed after use, you can use try-resource pattern to close it automatically: try (Stream<PointValues> rows = client.queryPoints("select * from cpu", options)) { rows.forEach(row -> { // process row } });- Parameters:
- query- the SQL query string to execute, cannot be null
- Returns:
- Batches of PointValues returned by the query
 Note: the timestamp will be returned as a number of nanoseconds since the Unix epoch 
 
- 
queryPoints@Nonnull Stream<PointValues> queryPoints(@Nonnull String query, @Nonnull Map<String, Object> parameters) Query data from InfluxDB IOx into Point structure using FlightSQL.The result stream should be closed after use, you can use try-resource pattern to close it automatically: try (Stream<PointValues> rows = client.queryPoints("select * from cpu where host=$host", Map.of("host", "server-a"))) { rows.forEach(row -> { // process row } });- Parameters:
- query- the SQL query string to execute, cannot be null
- parameters- query named parameters
- Returns:
- Batches of PointValues returned by the query
 Note: the timestamp will be returned as a number of nanoseconds since the Unix epoch 
 
- 
queryPointsQuery data from InfluxDB IOx into Point structure using FlightSQL.The result stream should be closed after use, you can use try-resource pattern to close it automatically: try (Stream<PointValues> rows = client.queryPoints("select * from cpu", options)) { rows.forEach(row -> { // process row } });- Parameters:
- query- the query string to execute, cannot be null
- options- the options for querying data from InfluxDB
- Returns:
- Batches of PointValues returned by the query
 Note: the timestamp will be returned as a number of nanoseconds since the Unix epoch 
 
- 
queryPoints@Nonnull Stream<PointValues> queryPoints(@Nonnull String query, @Nonnull Map<String, Object> parameters, @Nonnull QueryOptions options) Query data from InfluxDB IOx into Point structure using FlightSQL.The result stream should be closed after use, you can use try-resource pattern to close it automatically: try (Stream<PointValues> rows = client.queryPoints("select * from cpu where host=$host", Map.of("host", "server-a"), options)) { rows.forEach(row -> { // process row } });- Parameters:
- query- the query string to execute, cannot be null
- parameters- query named parameters
- options- the options for querying data from InfluxDB
- Returns:
- Batches of PointValues returned by the query
 Note: the timestamp will be returned as a number of nanoseconds since the Unix epoch 
 
- 
queryBatchesQuery data from InfluxDB IOx using FlightSQL.The result stream should be closed after use, you can use try-resource pattern to close it automatically: try (Stream<VectorSchemaRoot> batches = client.queryBatches("select * from cpu")) { batches.forEach(batch -> { // process batch } });- Parameters:
- query- the SQL query string to execute, cannot be null
- Returns:
- Batches of rows returned by the query
 
- 
queryBatches@Nonnull Stream<org.apache.arrow.vector.VectorSchemaRoot> queryBatches(@Nonnull String query, @Nonnull Map<String, Object> parameters) Query data from InfluxDB IOx using FlightSQL.The result stream should be closed after use, you can use try-resource pattern to close it automatically: try (Stream<VectorSchemaRoot> batches = client.queryBatches("select * from cpu where host=$host", Map.of("host", "server-a"))) { batches.forEach(batch -> { // process batch } });- Parameters:
- query- the SQL query string to execute, cannot be null
- parameters- query named parameters
- Returns:
- Batches of rows returned by the query
 
- 
queryBatches@Nonnull Stream<org.apache.arrow.vector.VectorSchemaRoot> queryBatches(@Nonnull String query, @Nonnull QueryOptions options) Query data from InfluxDB IOx using FlightSQL.try (Stream<VectorSchemaRoot> batches = client.queryBatches("select * from cpu", options)) { batches.forEach(batch -> { // process batch } });- Parameters:
- query- the query string to execute, cannot be null
- options- the options for querying data from InfluxDB
- Returns:
- Batches of rows returned by the query
 
- 
queryBatches@Nonnull Stream<org.apache.arrow.vector.VectorSchemaRoot> queryBatches(@Nonnull String query, @Nonnull Map<String, Object> parameters, @Nonnull QueryOptions options) Query data from InfluxDB IOx using FlightSQL.try (Stream<VectorSchemaRoot> batches = client.queryBatches("select * from cpu where host=$host", Map.of("host", "server-a"), options)) { batches.forEach(batch -> { // process batch } });- Parameters:
- query- the query string to execute, cannot be null
- parameters- query named parameters
- options- the options for querying data from InfluxDB
- Returns:
- Batches of rows returned by the query
 
- 
getServerVersionGet InfluxDB server version.- Returns:
- a string representing the server version.
 Returns nullif the server version can't be determined.
 
- 
getInstance@Nonnull static InfluxDBClient getInstance(@Nonnull String host, @Nullable char[] token, @Nullable String database) Creates a new instance of theInfluxDBClientfor interacting with an InfluxDB server, simplifying common operations such as writing, querying.- Parameters:
- host- the URL of the InfluxDB server
- token- the authentication token for accessing the InfluxDB server, can be null
- database- the database to be used for InfluxDB operations, can be null
- Returns:
- new instance of the InfluxDBClient
 
- 
getInstance@Nonnull static InfluxDBClient getInstance(@Nonnull String host, @Nullable char[] token, @Nullable String database, @Nullable Map<String, String> defaultTags) Creates a new instance of theInfluxDBClientfor interacting with an InfluxDB server, simplifying common operations such as writing, querying.- Parameters:
- host- the URL of the InfluxDB server
- token- the authentication token for accessing the InfluxDB server, can be null
- database- the database to be used for InfluxDB operations, can be null
- defaultTags- tags to be added by default to writes of points
- Returns:
- new instance of the InfluxDBClient
 
- 
getInstanceCreates a new instance of theInfluxDBClientfor interacting with an InfluxDB server, simplifying common operations such as writing, querying. For possible configuration options seeClientConfig.- Parameters:
- config- the configuration for the InfluxDB client
- Returns:
- new instance of the InfluxDBClient
 
- 
getInstanceCreates a new instance of theInfluxDBClientfrom the connection string in URL format.Example: client = InfluxDBClient.getInstance("https://us-east-1-1.aws.cloud2.influxdata.com/" + "?token=my-token&database=my-database");Supported parameters: - token - authentication token (required)
- org - organization name
- database - database (bucket) name
- precision - timestamp precision when writing data
- gzipThreshold - payload size size for gzipping data
- writeNoSync - skip waiting for WAL persistence on write
 - Parameters:
- connectionString- connection string
- Returns:
- instance of InfluxDBClient
 
- 
getInstanceCreates a new instance of theInfluxDBClientfrom environment variables and/or system properties. Environment variables take precedence over system properties.Example: client = InfluxDBClient.getInstance(); Supported environment variables: - INFLUX_HOST - cloud/server URL required
- INFLUX_TOKEN - authentication token required
- INFLUX_AUTH_SCHEME - authentication scheme
- INFLUX_ORG - organization name
- INFLUX_DATABASE - database (bucket) name
- INFLUX_PRECISION - timestamp precision when writing data
- INFLUX_GZIP_THRESHOLD - payload size size for gzipping data
- INFLUX_WRITE_NO_SYNC - skip waiting for WAL persistence on write
 - influx.host - cloud/server URL required
- influx.token - authentication token required
- influx.authScheme - authentication scheme
- influx.org - organization name
- influx.database - database (bucket) name
- influx.precision - timestamp precision when writing data
- influx.gzipThreshold - payload size size for gzipping data
- influx.writeNoSync - skip waiting for WAL persistence on write
 - Returns:
- instance of InfluxDBClient
 
 
-