Arrow Flight Client Node.js
Sur cette page

Arrow Flight Client

TypeScript 7 Python 3 10 méthodes gRPC 0.0.19

Client Apache Arrow Flight pour Node.js. Il offre un accès typé à toutes les méthodes gRPC unaires et en streaming du contrat Flight officiel.

Installation

Installez le client et sa dépendance pair obligatoire, apache-arrow, dans votre projet.

Shell
npm install arrow-flight-client apache-arrow

Lire une table

Démarrez le serveur Flight local. Il expose une table associée au descripteur demo/people. Appelez getFlightInfo() pour obtenir les informations sur la table, puis transmettez le ticket obtenu à 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();
}

Exécutez l’exemple avec la commande ci-dessous. Le résultat contient deux lignes avec les noms Ada et Lin.

Shell
node client.ts