The Rust binding source lives in the kernel repo at
databricks-sql-kernel/napi/. Building it requires a local checkout
of that repo — see "Build for local dev" below. The published npm
package is @databricks/databricks-sql-kernel-<triple>.
The napi crate is a standalone Cargo workspace ([workspace] members = ["."] in napi/Cargo.toml), not a sibling of pyo3/
in the kernel root workspace.
The reason is Cargo feature unification. pyo3 builds the kernel with
the default tls-native feature (system OpenSSL via native-tls).
The napi crate has to opt INTO tls-rustls instead: napi modules are
loaded into Node.js processes that statically link OpenSSL 3.x, and
dynamically linking the system's OpenSSL 1.1 (which native-tls
pulls in on Linux) collides with Node's symbols at module-load time
and segfaults the process before any Rust code runs. rustls is
pure Rust + ring and avoids the conflict entirely.
If napi lived in the same workspace as pyo3, cargo build --workspace would unify the kernel's feature set to tls-native ∪ tls-rustls, link both TLS stacks into the resulting napi cdylib,
and reintroduce the same clash. Standalone-workspace is the fix.
index.d.ts— TypeScript declarations consumed bylib/kernel/. Generated by napi-rs from the Rust source; checked in as the consumer-facing type contract.index.js— napi-rs's per-platform router shim. Gitignored; populated bynpm run build:nativefor local dev. In published tarballs it ships alongside the.d.tsandrequire()s the right@databricks/databricks-sql-kernel-<triple>optional dependency.index.*.node— the actual native binary, one per platform. Gitignored. In production these live in the per-triple optional dependencies (@databricks/databricks-sql-kernel-linux-x64-gnu, etc.); for local devnpm run build:nativecopies one into this directory.
# From the nodejs repo root:
export DATABRICKS_SQL_KERNEL_REPO=/path/to/your/databricks-sql-kernel
npm run build:native # release build (default)
BUILD_PROFILE= npm run build:native # debug build (empty BUILD_PROFILE drops --release)DATABRICKS_SQL_KERNEL_REPO points at the kernel repo root (the
directory containing napi/) and is required when your kernel
checkout isn't at ../../databricks-sql-kernel relative to the
nodejs repo.
At release time the kernel's CI publishes
@databricks/databricks-sql-kernel-<triple> npm packages — one per supported
platform — each containing a single .node binary. native/kernel/index.js
(the napi-rs router) require()s the package matching the consumer's
process.platform / process.arch at load time.
Status: the per-platform packages are published on npm (kernel
0.2.0) and declared in the driver'soptionalDependencies, pinned to that exact version.npm installresolves only the package matching the consumer'sprocess.platform/process.arch; the others are skipped (that is whatoptionalDependenciestolerates), so installing on an unsupported platform does not fail. Local development can still override the installed binary withnpm run build:native, which copies a freshly builtindex.<triple>.nodeinto this directory — the router prefers that local file over the installed package.
The driver declares all eight published triples in optionalDependencies:
linux-x64-gnu,linux-arm64-gnulinux-x64-musl,linux-arm64-musldarwin-x64,darwin-arm64win32-x64-msvc,win32-arm64-msvc
On any other platform (e.g. linux-arm gnueabihf, riscv64, s390x, FreeBSD)
the kernel binding is simply absent: KernelNativeLoader returns
undefined from tryGet() / throws a structured MODULE_NOT_FOUND hint
from get(), and the driver continues to use the Thrift backend
exclusively. This is expected, not a regression — additional triples are
added to optionalDependencies as the kernel CI starts publishing them.
The triple names not yet built/published (…-linux-arm-gnueabihf,
…-riscv64-gnu, etc.) referenced by the router boilerplate are not
squat-able: @databricks is a Databricks-owned npm scope, and npm
only allows org members to publish under a scope it owns. A third
party therefore cannot register @databricks/databricks-sql-kernel-* and have
the router autoload it. No placeholder packages are required.