Registry / database / drizzle-orm-databricks

drizzle-orm-databricks

JSON →
library0.1.2jsnpmunverified

A standalone Drizzle ORM adapter for Databricks SQL warehouses (v0.1.2, actively maintained). It provides Databricks-native column types, Spark SQL generation, and uses the official @databricks/sql Node.js driver. Unlike Drizzle's traditional adapters, this one has zero dependency on mysql-core, pg-core, or sqlite-core, making it lightweight and purpose-built for the Databricks ecosystem. It supports personal access tokens and OAuth M2M authentication, and integrates seamlessly with Drizzle's query builder. Requires Node.js >=22.

npm install drizzle-orm-databricks
INSTALL
IMPORT
SIG · DRIZZLE-ORM-DATABR
D
drizzle-orm-databricks
databasejavascriptv0.1.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

drizzle
import { drizzle } from 'drizzle-orm-databricks'
import { drizzle } from 'drizzle-orm'
The `drizzle` function here is specifically the Databricks adapter; do not import from 'drizzle-orm'.
databricksTable
import { databricksTable } from 'drizzle-orm-databricks'
import { databricksTable } from 'drizzle-orm/databricks'
All core symbols are exported from the root package, not a subpath.
string
import { string } from 'drizzle-orm-databricks'
import { string } from 'drizzle-orm/mysql-core'
Column builders are specific to Databricks; do not mix with MySQL or PostgreSQL column definitions.
DrizzleConfig
import type { DrizzleConfig } from 'drizzle-orm'
import { DrizzleConfig } from 'drizzle-orm-databricks'
DrizzleConfig is a TypeScript type exported only from 'drizzle-orm' for type safety.

Demonstrates basic CRUD operations: table schema definition, query, insert, update, delete, and graceful connection close with Databricks SQL.

import { drizzle, databricksTable, string, bigint, timestamp, boolean } from 'drizzle-orm-databricks'; import { eq } from 'drizzle-orm'; const users = databricksTable('users', { id: string('id').primaryKey(), email: string('email').notNull(), loginCount: bigint('login_count').notNull(), active: boolean('active').notNull(), createdAt: timestamp('created_at').notNull(), }); const db = drizzle({ host: process.env.DATABRICKS_HOST ?? '', path: process.env.DATABRICKS_SQL_PATH ?? '', token: process.env.DATABRICKS_TOKEN ?? '', }); const rows = await db.select().from(users).where(eq(users.active, true)); await db.insert(users).values({ id: crypto.randomUUID(), email: 'a@b.com', loginCount: BigInt(0), active: true, createdAt: new Date(), }); await db.update(users).set({ active: false }).where(eq(users.id, 'u1')); await db.delete(users).where(eq(users.id, 'u1')); await db.$close();
Debug
Known issues
breakingNode.js >=22 required. This package uses modern Node.js features (like crypto.randomUUID) and the peer dependency @databricks/sql may have its own Node version requirements.
fix
Upgrade Node.js to v22 or later.
affects: >=0.1.0
gotchaWhen passing an existing DBSQLClient to `drizzle({ client })`, calling `db.$close()` only closes the session, not the client. The caller is responsible for the client lifecycle.
fix
If you manage the client externally, you must manually close it after closing the Drizzle instance.
affects: >=0.1.0
gotchaColumn type `bigint` maps to `BIGINT` in Spark SQL and expects JS `BigInt` values (not regular numbers). Using a plain number may cause runtime errors or type mismatches.
fix
Always pass `BigInt(value)` for bigint columns.
affects: >=0.1.0
gotchaThe `timestamp` column function maps to `TIMESTAMP` (with time zone). If you need TIMESTAMP_NTZ (no time zone), use `timestampNtz` from the package.
fix
Use the dedicated `timestampNtz` function for timezone-naive timestamps.
affects: >=0.1.0
Errors
Common errors & fixes
Error: Cannot find module 'drizzle-orm-databricks'
Package not installed or not in node_modules.
fix
Run `npm install drizzle-orm-databricks drizzle-orm @databricks/sql` (or pnpm/yarn equivalent).
TypeError: drizzle is not a function
Importing `drizzle` from the wrong package (e.g., 'drizzle-orm') instead of 'drizzle-orm-databricks'.
fix
Use `import { drizzle } from 'drizzle-orm-databricks'`.
Error: The 'bigint' column expects a BigInt value.
Inserting a regular JavaScript number into a bigint column.
fix
Wrap the number with `BigInt(value)`, e.g., `loginCount: BigInt(0)`.
Error: Spark SQL does not support ON CONFLICT clause.
Using Drizzle's `onConflictDoNothing()` or `onConflictDoUpdate()` which generate SQL with `ON CONFLICT`, not supported in Databricks.
fix
Avoid upsert methods; use separate insert and update operations.
Upgrade
Version history
0.1.2latest on npm
Audit
Dependencies
@databricks/sqlrequiredPeer dependency: official Databricks SQL client driver for Node.js.
drizzle-ormrequiredPeer dependency: Drizzle ORM core library (>=0.45.0).
Agent activity
10 hits · last 30 days
node
8
Resources
drizzle-orm-databricks — npm install drizzle-orm-databricks · libregistry