Arrow Flight Client Node.js
En esta página

Arrow Flight Client

TypeScript 7 Python 3 10 métodos gRPC 0.0.19

Cliente de Apache Arrow Flight para Node.js. Ofrece acceso tipado a todos los métodos gRPC unarios y de streaming definidos en el contrato oficial de Flight.

Instalación

Instala el cliente y su dependencia obligatoria apache-arrow en tu proyecto.

Shell
npm install arrow-flight-client apache-arrow

Leer una tabla

Inicia el servidor Flight local. El servidor ofrece una tabla con el descriptor demo/people. Consulta la información de la tabla con getFlightInfo() y pasa el ticket recibido a getTable().

client.ts
import { FlightClient, pathDescriptor } from 'arrow-flight-client';

const client = new FlightClient('127.0.0.1:8815');

try {
  const info = await client.getFlightInfo(pathDescriptor('demo', 'people'));
  const ticket = info.endpoints[0]?.ticket;

  if (!ticket) {
    throw new Error('The Flight endpoint has no ticket');
  }

  const table = await client.getTable(ticket);
  console.log(table.toString());
}
finally {
  await client.close();
}

Ejecuta el ejemplo con el siguiente comando. El resultado contiene dos filas con los nombres Ada y Lin.

Shell
node client.ts