@apache-arrow/adbc-driver-manager

中文文档
0.25.0发布于 2026/10/26Apache-2.0TypeScriptES Module零依赖近 30 天下载 4736

Node.js ADBC Driver Manager

原始使用文档
文档目录7 节
  1. Installation
  2. Usage
  3. Development
  4. Prerequisites
  5. Building from Source
  6. Testing
  7. License

Apache Arrow ADBC: Node.js Driver Manager

Node.js bindings for the Arrow Database Connectivity (ADBC) standard. Built on a native NAPI addon — requires Node.js 22+ and does not support browser or Deno environments. Bun is not officially tested.

Alpha. APIs may change without notice. If you try this and run into issues or have feedback, please open an issue.

Installation

npm install @apache-arrow/adbc-driver-manager apache-arrow

Usage

The driver option accepts either a full path to a shared library or a short name. When using a short name, the driver manager searches system and user paths for a matching ADBC driver manifest or library.

import { AdbcDatabase } from '@apache-arrow/adbc-driver-manager'

// Short name (resolves from system/user paths)
const db = new AdbcDatabase({ driver: 'sqlite' })
// Or a full path to a driver shared library
const db = new AdbcDatabase({ driver: '/path/to/libadbc_driver_sqlite.dylib' })

Once you have a database, open a connection and run queries:

const connection = await db.connect()

// Execute a query — returns an Apache Arrow Table
const table = await connection.query('SELECT 1 AS value')
console.log(table.toArray())

// For large result sets, stream record batches instead
const reader = await connection.queryStream('SELECT * FROM large_table')
for await (const batch of reader) {
  console.log(`Received batch with ${batch.numRows} rows`)
}

// DML — returns the number of affected rows
const affected = await connection.execute('DELETE FROM my_table WHERE id = 1')

await connection.close()
await db.close()

For finer-grained control, use the statement API directly:

import { tableFromArrays } from 'apache-arrow'

const stmt = await connection.createStatement()
await stmt.setSqlQuery('SELECT * FROM my_table WHERE id = ?')
await stmt.bind(tableFromArrays({ id: [42] }))
const reader = await stmt.executeQuery()
for await (const batch of reader) {
  console.log(batch.toArray())
}
await stmt.close()

Development

Prerequisites

  • Node.js 22+
  • Rust (latest stable)
  • CMake 3.14+ and a C/C++ compiler (for building the driver libraries)
  • npm (usually comes with Node.js)

Building from Source

  1. Install dependencies:

    npm install
    
  2. Build the Rust addon:

    npm run build:debug   # debug build (faster)
    npm run build         # release build
    

Testing

The tests require a built ADBC driver library (e.g. SQLite). Build everything including the SQLite driver with:

npm run build:driver

This runs CMake to compile the C ADBC drivers into build/lib/ and builds the Rust Node.js addon. Once built, run the tests:

npm test

License

Apache-2.0

版本与发布记录

@apache-arrow/adbc-driver-manager 共发布 3 个版本,首次发布于 2026/04/08;过去 12 个月发布了 3 个版本。

版本发布日期距今
0.25.0latest2026/10/2612 天前
0.24.02026/07/283 个月前
0.23.02026/04/086 个月前

关于 @apache-arrow/adbc-driver-manager 的常见问题

@apache-arrow/adbc-driver-manager 是什么?

Node.js ADBC Driver Manager

如何安装 @apache-arrow/adbc-driver-manager?

在项目目录运行 npm install @apache-arrow/adbc-driver-manager,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:apache-arrow(^21.1.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@apache-arrow/adbc-driver-manager 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@apache-arrow/adbc-driver-manager 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@apache-arrow/adbc-driver-manager 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=22.0.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@apache-arrow/adbc-driver-manager 可以商用吗?

@apache-arrow/adbc-driver-manager 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@apache-arrow/adbc-driver-manager 的下载量有多少?

根据 npm 官方下载统计,@apache-arrow/adbc-driver-manager 在 2026/10/06 – 2026/11/04 这 30 天内被下载 4,736 次,日均约 158 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@apache-arrow/adbc-driver-manager 还在维护吗?

最新版本 0.25.0 发布于 2026/10/26(12 天前);至今共发布 3 个版本,其中过去 12 个月发布了 3 个;首次发布于 2026/04/08。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。