Arrow Flight Client
TypeScript 7 Python 3 10 métodos gRPC 0.0.19
Cliente Apache Arrow Flight para Node.js. Oferece acesso tipado a todos os métodos gRPC unários e de streaming definidos no protocolo oficial do Flight.
Instalação
Instale o cliente e a dependência obrigatória apache-arrow no seu projeto.
Shell
npm install arrow-flight-client apache-arrow
Ler uma tabela
Inicie o servidor Flight local. O servidor disponibiliza uma tabela associada ao descritor demo/people. Chame getFlightInfo() para obter informações sobre a tabela e passe o ticket retornado 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();
}
Execute o exemplo com o comando abaixo. A saída contém duas linhas com os nomes Ada e Lin.
Shell
node client.ts