Apache Arrow Flight RPC clients
Flight RPC and Flight SQL clients are language-specific drivers that interact with databases using the Arrow in-memory format and the Flight RPC protocol. Apache Arrow Flight RPC and Flight SQL protocols define APIs for servers and clients.
Use InfluxDB v3 client libraries
We recommend using InfluxDB v3 client libraries for integrating InfluxDB v3 with your application code. Client libraries wrap Apache Arrow Flight clients and provide convenient methods for writing, querying, and processing data stored in InfluxDB Cloud Dedicated.
Flight RPC clients can use SQL or InfluxQL to query data stored in an InfluxDB Cloud Dedicated database.
Using InfluxDB v3’s IOx-specific Flight RPC protocol, clients send a single DoGet()
request to authenticate, query, and retrieve data.
Flight SQL clients use the Flight SQL protocol for querying an SQL database server. They can use SQL to query data stored in an InfluxDB Cloud Dedicated database, but they can’t use InfuxQL.
Clients are maintained by Apache Arrow projects or third-parties. For specifics about a Flight client, see the client’s GitHub repository.
C# .NET Flight client
The C# .NET Flight client integrates with C# .NET scripts and applications to query data stored in InfluxDB.
Go Flight client
The Go Flight client integrates with Go scripts and applications to query data stored in InfluxDB.
Java Flight SQL package
The Java Flight SQL client integrates with Java applications to query and retrieve data from Flight database servers using RPC and SQL.
public class Query {
public static void main(String[] args) {
String query = "SELECT * FROM home";
Location location = Location.forGrpcTls(HOST, 443);
CredentialCallOption auth = new CredentialCallOption(new BearerCredentialWriter(TOKEN));
BufferAllocator allocator = new RootAllocator(Long.MAX_VALUE);
FlightClientMiddleware.Factory f = info -> new FlightClientMiddleware() {
@Override
public void onBeforeSendingHeaders(CallHeaders outgoingHeaders) {
outgoingHeaders.insert(DATABASE_FIELD, DATABASE_NAME);
}
};
FlightClient client = FlightClient.builder(allocator, location)
.intercept(f)
.build();
FlightSqlClient sqlClient = new FlightSqlClient(client);
FlightInfo flightInfo = sqlClient.execute(query, auth);
}
}
Python Flight client
The Python Flight client integrates with Python scripts and applications to query data stored in InfluxDB.
from pyarrow.flight import FlightClient, Ticket, FlightCallOptions
import json
import pandas
import tabulate
# Downsampling query groups data into 2-hour bins
sql="""
SELECT DATE_BIN(INTERVAL '2 hours',
time,
'1970-01-01T00:00:00Z') AS time,
room,
selector_max(temp, time)['value'] AS 'max temp',
selector_min(temp, time)['value'] AS 'min temp',
avg(temp) AS 'average temp'
FROM home
GROUP BY
1,
room
ORDER BY room, 1"""
flight_ticket = Ticket(json.dumps({
"namespace_name": "DATABASE_NAME",
"sql_query": sql,
"query_type": "sql"
}))
token = (b"authorization", bytes(f"Bearer DATABASE_TOKEN".encode('utf-8')))
options = FlightCallOptions(headers=[token])
client = FlightClient(f"grpc+tls://cluster-id.a.influxdb.io:443")
reader = client.do_get(flight_ticket, options)
arrow_table = reader.read_all()
Python Flight SQL DBAPI client
The Python flightsql-dbapi
library uses SQL and the Flight SQL protocol to query data stored in an InfluxDB Cloud Dedicated database.
Was this page helpful?
Thank you for your feedback!
Support and feedback
Thank you for being part of our community! We welcome and encourage your feedback and bug reports for InfluxDB and this documentation. To find support, use the following resources:
Customers with an annual or support contract can contact InfluxData Support.