Query with Flight SQL
Use Apache Arrow Flight SQL to query data stored in an InfluxDB Cloud Serverless bucket.
Arrow Flight SQL is a protocol for interacting with SQL databases using the Arrow in-memory format and the Flight RPC framework.
Data platforms and clients that support the Flight SQL protocol can query data stored in an InfluxDB Cloud Serverless bucket. Learn how to connect to InfluxDB and query your data using the following tools:
Use Java and the Flight SQL package to query data
Use Java and the org.apache.arrow.flight.sql
Flight SQL package to query data stored in an InfluxDB Cloud Serverless bucket.
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);
}
}
Use Python and the Flight SQL library to query data
Use Python and the flightsql-dbapi
Flight SQL library to query data stored in an InfluxDB Cloud Serverless bucket.
from flightsql import FlightSQLClient
client = FlightSQLClient(host='cloud2.influxdata.com',
token='INFLUX_READ_WRITE_TOKEN',
metadata={'database': 'BUCKET_NAME'},
features={'metadata-reflection': 'true'})
info = client.execute("SELECT * FROM home")
ticket = info.endpoints[0].ticket
reader = client.do_get(ticket)
Use Superset to query data
Install and run Apache Superset to query data stored in an InfluxDB Cloud Serverless bucket.
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:
InfluxDB Cloud and InfluxDB Enterprise customers can contact InfluxData Support.