Read a table
Find a resource with a ticket on the local Flight server. The getTable() call collects all batches for that ticket into one Arrow table.
read-table.ts
import { FlightClient } from 'arrow-flight-client';
async function main() {
const client = new FlightClient('127.0.0.1:8815');
try {
for await (const flight of client.listFlights()) {
const ticket = flight.endpoints.find(endpoint => endpoint.ticket)?.ticket;
if (ticket) {
const table = await client.getTable(ticket);
console.log(table.toString());
return;
}
}
throw new Error('No Flight endpoint with a ticket was found');
}
finally {
await client.close();
}
}
await main();
Use streaming reads to process individual batches.