Arrow Flight Client Node.js

Ler uma tabela

Encontre um recurso com ticket no servidor Flight local. A chamada a getTable() reúne todos os lotes de dados associados ao ticket em uma tabela 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 processar os lotes separadamente, use a leitura de um fluxo.