Arrow Flight Client Node.js

Leer una tabla

Busca un recurso con un ticket en el servidor Flight local. La llamada a getTable() reúne todos los lotes asociados con ese ticket en una tabla 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();

Para procesar cada lote por separado, usa la lectura en streaming.