Close the connection and release resources.
Execute an action on the server.
Action to execute
Async iterator of results
Open a bidirectional data exchange with the server.
This is the low-level API for DoExchange. For real-time subscriptions,
use the higher-level subscribe() method instead.
Flight descriptor for the exchange
An exchange handle for sending and receiving FlightData
const exchange = client.doExchange({
type: DescriptorType.CMD,
cmd: new TextEncoder().encode('SUBSCRIBE:my_topic')
})
// Send initial request
await exchange.send({ appMetadata: subscribeCommand })
// Receive responses
for await (const data of exchange) {
if (data.dataHeader) {
// Process record batch
}
}
// Clean up
await exchange.end()
Retrieve data for a ticket as an async iterator of FlightData.
Ticket from FlightInfo endpoint
Upload Arrow data to the server.
Flight descriptor describing the data
Async iterable of FlightData messages
Async iterator of PutResult messages
Execute a SQL update statement (INSERT, UPDATE, DELETE).
SQL statement
Optionaloptions: ExecuteOptionsOptional execution options
Number of rows affected
Get the list of catalogs available on the server.
Array of catalog information
Get the foreign key relationships between two tables.
This returns foreign keys in the foreign key table that reference the primary key of the primary key table.
Options specifying the primary key and foreign key tables
Array of foreign key information
Get the foreign keys that reference a table's primary key (exported keys).
Table name
Optionalcatalog: stringOptional catalog name
Optionalschema: stringOptional schema name
Array of foreign key information
Get flight information for a descriptor.
Flight descriptor
FlightInfo with schema and endpoints
Get the foreign keys in a table (imported keys).
Table name
Optionalcatalog: stringOptional catalog name
Optionalschema: stringOptional schema name
Array of foreign key information
Get the primary keys for a table.
Table name
Optionalcatalog: stringOptional catalog name
Optionalschema: stringOptional schema name
Array of primary key information
Get the schema for a flight descriptor without fetching data.
Flight descriptor
Schema result
Get the list of schemas available in a catalog.
Optionalcatalog: stringOptional catalog name to filter by
OptionalschemaFilterPattern: stringOptional SQL LIKE pattern to filter schema names
Array of schema information
Get SQL server information and capabilities.
OptionalinfoCodes: number[]Optional array of specific info codes to retrieve. If omitted, all available info is retrieved.
Array of SQL info name-value pairs
Get the list of tables available.
Optionaloptions: {Filter options
Array of table information
Get the list of table types supported by the server.
Array of table type names (e.g., "TABLE", "VIEW", "SYSTEM TABLE")
Get XDBC type information supported by the server.
OptionaldataType: numberOptional specific data type code to retrieve info for. If omitted, all types are retrieved.
Array of XDBC type info objects
Check if the client is connected.
Create a prepared statement for repeated execution.
SQL query with optional parameter placeholders
Optionaloptions: ExecuteOptionsOptional prepared statement options
PreparedStatement that can be executed multiple times
Execute a SQL query and return a QueryResult for retrieving results.
SQL query string
Optionaloptions: ExecuteOptionsOptional execution options
QueryResult with stream() and collect() methods
Subscribe to real-time data updates from a query.
Returns a Subscription that yields RecordBatches as they arrive from the server. Automatically handles heartbeats and can reconnect on connection loss.
SQL query to subscribe to
Subscription options
Subscription handle for receiving batches and control
const subscription = await client.subscribe(
"SELECT * FROM events WHERE status = 'pending'",
{ mode: 'CHANGES_ONLY', heartbeatMs: 30000 }
)
for await (const batch of subscription) {
console.log(`Received ${batch.numRows} rows`)
}
// Or with AbortController
const controller = new AbortController()
const subscription = await client.subscribe(query, {
signal: controller.signal
})
// Later: cancel the subscription
controller.abort()
Flight SQL client for executing queries and managing data with Arrow Flight SQL servers.
Example