Skip to content

Latest commit

 

History

History

flight-sql-client

@ceramic-sdk/flight-sql-client

A client library for interacting with Arrow Flight SQL enabled databases from Node.js.

This library provides a thin wrapper around the flight-sql client implementation in the arrow-flight crate. Node bindings are created with the help of napi-rs. Originally forked from lakehouse-rs npm and github.

Usage

Install library

yarn add @ceramic-sdk/flight-sql-client
# or
npm install @ceramic-sdk/flight-sql-client
# or
pnpm add @ceramic-sdk/flight-sql-client

Create a new client instance

import { ClientOptions, createFlightSqlClient } from '@ceramic-sdk/flight-sql-client';
import { tableFromIPC } from 'apache-arrow';

const options: ClientOptions = {
  username: undefined,
  password: undefined,
  tls: false,
  host: '127.0.0.1',
  port: 5102,
  headers: [],
};

const client = await createFlightSqlClient(options);

Execute a query against the service

const buffer = await client.query('SELECT * FROM my_tyble');
const table = tableFromIPC(buffer);

Or inspect some server metadata

const buffer = await client.getTables({ includeSchema: true });
const table = tableFromIPC(buffer);

Development

Requirements:

  • Rust
  • node.js >= 18
  • Pnpm

Install dependencies via

pnpm i

Build native module

pnpm build

Run tests

pnpm test

Release

TODO