Package com.influxdb.v3.client
Interface InfluxDBClient
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
InfluxDBClientImpl
The InfluxDBClient interface provides a client for interact with InfluxDB 3.
This client supports both writing data to InfluxDB and querying data using the FlightSQL client,
which allows you to execute SQL queries against InfluxDB IOx.
-
Method Summary
Modifier and TypeMethodDescriptionstatic InfluxDBClient
getInstance
(InfluxDBClientConfigs configs) Creates a new instance of theInfluxDBClient
for interacting with an InfluxDB server, simplifying common operations such as writing, querying.static InfluxDBClient
getInstance
(String hostUrl, char[] authToken, String database) Creates a new instance of theInfluxDBClient
for interacting with an InfluxDB server, simplifying common operations such as writing, querying.Query data from InfluxDB IOx using FlightSQL.query
(String query, QueryParameters parameters) 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, QueryParameters parameters) Query data from InfluxDB IOx using FlightSQL.void
writePoint
(Point point) Write aPoint
to the InfluxDB server.void
writePoint
(Point point, WriteParameters parameters) Write aPoint
to the InfluxDB server.void
writePoints
(List<Point> points) Write a list ofPoint
to the InfluxDB server.void
writePoints
(List<Point> points, WriteParameters parameters) Write a list ofPoint
to the InfluxDB server.void
writeRecord
(String record) Write a record specified in the InfluxDB Line Protocol to the InfluxDB server.void
writeRecord
(String record, WriteParameters parameters) Write a record specified in the InfluxDB Line Protocol to the InfluxDB server.void
writeRecords
(List<String> records) Write records specified in the InfluxDB Line Protocol to the InfluxDB server.void
writeRecords
(List<String> records, WriteParameters parameters) Write records specified in the InfluxDB Line Protocol to the InfluxDB server.Methods inherited from interface java.lang.AutoCloseable
close
-
Method Details
-
writeRecord
Write 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
-
writeRecord
Write a record specified in the InfluxDB Line Protocol to the InfluxDB server.- Parameters:
record
- the record specified in the InfluxDB Line Protocol, can be nullparameters
- the parameters for writing data to InfluxDB
-
writeRecords
Write records specified in the InfluxDB Line Protocol to the InfluxDB server.- Parameters:
records
- the records specified in the InfluxDB Line Protocol, cannot be null
-
writeRecords
Write records specified in the InfluxDB Line Protocol to the InfluxDB server.- Parameters:
records
- the records specified in the InfluxDB Line Protocol, cannot be nullparameters
- the parameters for writing data to InfluxDB
-
writePoint
Write aPoint
to the InfluxDB server.- Parameters:
point
- thePoint
to write, can be null
-
writePoint
Write aPoint
to the InfluxDB server.- Parameters:
point
- thePoint
to write, can be nullparameters
- the parameters for writing data to InfluxDB
-
writePoints
Write a list ofPoint
to the InfluxDB server.- Parameters:
points
- the list ofPoint
to write, cannot be null
-
writePoints
Write a list ofPoint
to the InfluxDB server.- Parameters:
points
- the list ofPoint
to write, cannot be nullparameters
- the parameters for writing data to InfluxDB
-
query
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")) { rows.forEach(row -> { // process row } });
- Parameters:
query
- the SQL query string to execute, cannot be null- Returns:
- Batches of rows returned by the query
-
query
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", parameters)) { rows.forEach(row -> { // process row } });
- Parameters:
query
- the SQL query string to execute, cannot be nullparameters
- the parameters for querying data from InfluxDB- Returns:
- Batches of rows returned by the query
-
queryBatches
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")) { 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 QueryParameters parameters) Query data from InfluxDB IOx using FlightSQL.try (Stream<VectorSchemaRoot> batches = client.queryBatches("select * from cpu", parameters)) { batches.forEach(batch -> { // process batch } });
- Parameters:
query
- the SQL query string to execute, cannot be nullparameters
- the parameters for querying data from InfluxDB- Returns:
- Batches of rows returned by the query
-
getInstance
@Nonnull static InfluxDBClient getInstance(@Nonnull String hostUrl, @Nullable char[] authToken, @Nullable String database) Creates a new instance of theInfluxDBClient
for interacting with an InfluxDB server, simplifying common operations such as writing, querying.- Parameters:
hostUrl
- the hostname or IP address of the InfluxDB serverauthToken
- the authentication token for accessing the InfluxDB server, can be nulldatabase
- the database to be used for InfluxDB operations, can be null- Returns:
- new instance of the
InfluxDBClient
-
getInstance
Creates a new instance of theInfluxDBClient
for interacting with an InfluxDB server, simplifying common operations such as writing, querying.- Parameters:
configs
- the configuration for the InfluxDB client- Returns:
- new instance of the
InfluxDBClient
-