Lire une table
Recherchez une ressource munie d’un ticket sur le serveur Flight local. L’appel à getTable() rassemble tous les lots de données associés au ticket dans une table Arrow.
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();
Pour traiter les lots un par un, utilisez la lecture en streaming.