@leonardovida-md/drizzle-neo-duckdb 1.3.1 → 1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -16
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
### DuckDB dialect for [Drizzle ORM](https://orm.drizzle.team/)
|
|
6
6
|
|
|
7
|
-
[](https://www.npmjs.com/package/@duckdbfan/drizzle-duckdb)
|
|
8
8
|
[](https://opensource.org/licenses/Apache-2.0)
|
|
9
9
|
|
|
10
|
-
[Documentation](https://leonardovida.github.io/drizzle-
|
|
10
|
+
[Documentation](https://leonardovida.github.io/drizzle-duckdb/) • [LLM Context](https://leonardovida.github.io/drizzle-duckdb/llms.txt) • [Examples](./example) • [Contributing](#contributing)
|
|
11
11
|
|
|
12
12
|
</div>
|
|
13
13
|
|
|
@@ -19,29 +19,34 @@ Works with local DuckDB files, in-memory databases, and [MotherDuck](https://mot
|
|
|
19
19
|
|
|
20
20
|
> **Status:** Experimental. Core query building, migrations, and type inference work well. Some DuckDB-specific types and edge cases are still being refined.
|
|
21
21
|
|
|
22
|
-
> **Note:** The NPM package is `@
|
|
22
|
+
> **Note:** The main NPM package is now `@duckdbfan/drizzle-duckdb`.
|
|
23
|
+
> The previous package `@leonardovida-md/drizzle-neo-duckdb` remains published but will be deprecated.
|
|
24
|
+
> Updates will land in both packages through May 2, 2026.
|
|
25
|
+
> After that date, only `@duckdbfan/drizzle-duckdb` will receive updates.
|
|
23
26
|
|
|
24
27
|
Docs tip: every docs page has a **Markdown (raw)** button for LLM-friendly source.
|
|
25
28
|
|
|
26
29
|
## Installation
|
|
27
30
|
|
|
28
31
|
```bash
|
|
29
|
-
bun add @
|
|
32
|
+
bun add @duckdbfan/drizzle-duckdb @duckdb/node-api
|
|
30
33
|
```
|
|
31
34
|
|
|
32
35
|
```bash
|
|
33
|
-
npm install @
|
|
36
|
+
npm install @duckdbfan/drizzle-duckdb @duckdb/node-api
|
|
34
37
|
```
|
|
35
38
|
|
|
36
39
|
```bash
|
|
37
|
-
pnpm add @
|
|
40
|
+
pnpm add @duckdbfan/drizzle-duckdb @duckdb/node-api
|
|
38
41
|
```
|
|
39
42
|
|
|
43
|
+
Recommended client version is `@duckdb/node-api@1.4.4-r.1`, which bundles DuckDB 1.4.4.
|
|
44
|
+
|
|
40
45
|
## Quick Start
|
|
41
46
|
|
|
42
47
|
```typescript
|
|
43
48
|
import { DuckDBInstance } from '@duckdb/node-api';
|
|
44
|
-
import { drizzle } from '@
|
|
49
|
+
import { drizzle } from '@duckdbfan/drizzle-duckdb';
|
|
45
50
|
import { sql } from 'drizzle-orm';
|
|
46
51
|
import { integer, text, pgTable } from 'drizzle-orm/pg-core';
|
|
47
52
|
|
|
@@ -134,7 +139,7 @@ import { DuckDBInstance } from '@duckdb/node-api';
|
|
|
134
139
|
import {
|
|
135
140
|
createDuckDBConnectionPool,
|
|
136
141
|
drizzle,
|
|
137
|
-
} from '@
|
|
142
|
+
} from '@duckdbfan/drizzle-duckdb';
|
|
138
143
|
|
|
139
144
|
const instance = await DuckDBInstance.create('md:', {
|
|
140
145
|
motherduck_token: process.env.MOTHERDUCK_TOKEN,
|
|
@@ -153,9 +158,9 @@ const db = drizzle(pool);
|
|
|
153
158
|
|
|
154
159
|
- Use `drizzle-orm/pg-core` for schemas; DuckDB SQL is largely Postgres-compatible.
|
|
155
160
|
- DuckDB-specific helpers: `duckDbList`, `duckDbArray`, `duckDbStruct`, `duckDbMap`, `duckDbJson`, `duckDbBlob`, `duckDbInet`, `duckDbInterval`, `duckDbTimestamp`, `duckDbDate`, `duckDbTime`.
|
|
156
|
-
- Browser-safe imports live under `@
|
|
161
|
+
- Browser-safe imports live under `@duckdbfan/drizzle-duckdb/helpers` (introspection emits this path).
|
|
157
162
|
|
|
158
|
-
See the [column types](https://leonardovida.github.io/drizzle-
|
|
163
|
+
See the [column types](https://leonardovida.github.io/drizzle-duckdb/api/columns) docs for full API.
|
|
159
164
|
|
|
160
165
|
## Postgres Schema Compatibility
|
|
161
166
|
|
|
@@ -202,7 +207,7 @@ import {
|
|
|
202
207
|
duckDbArrayContains,
|
|
203
208
|
duckDbArrayContained,
|
|
204
209
|
duckDbArrayOverlaps,
|
|
205
|
-
} from '@
|
|
210
|
+
} from '@duckdbfan/drizzle-duckdb';
|
|
206
211
|
|
|
207
212
|
// Check if array contains all values
|
|
208
213
|
const results = await db
|
|
@@ -241,12 +246,12 @@ await db.transaction(async (tx) => {
|
|
|
241
246
|
Apply SQL migration files using the `migrate` function:
|
|
242
247
|
|
|
243
248
|
```typescript
|
|
244
|
-
import { migrate } from '@
|
|
249
|
+
import { migrate } from '@duckdbfan/drizzle-duckdb';
|
|
245
250
|
|
|
246
251
|
await migrate(db, { migrationsFolder: './drizzle' });
|
|
247
252
|
```
|
|
248
253
|
|
|
249
|
-
Migration metadata is stored in `drizzle.__drizzle_migrations` by default. See [Migrations Documentation](https://leonardovida.github.io/drizzle-
|
|
254
|
+
Migration metadata is stored in `drizzle.__drizzle_migrations` by default. See [Migrations Documentation](https://leonardovida.github.io/drizzle-duckdb/guide/migrations) for configuration options.
|
|
250
255
|
|
|
251
256
|
## Schema Introspection
|
|
252
257
|
|
|
@@ -261,7 +266,7 @@ bunx duckdb-introspect --url ./my-database.duckdb --out ./drizzle/schema.ts
|
|
|
261
266
|
### Programmatic
|
|
262
267
|
|
|
263
268
|
```typescript
|
|
264
|
-
import { introspect } from '@
|
|
269
|
+
import { introspect } from '@duckdbfan/drizzle-duckdb';
|
|
265
270
|
|
|
266
271
|
const result = await introspect(db, {
|
|
267
272
|
schemas: ['public', 'analytics'],
|
|
@@ -271,7 +276,7 @@ const result = await introspect(db, {
|
|
|
271
276
|
console.log(result.files.schemaTs);
|
|
272
277
|
```
|
|
273
278
|
|
|
274
|
-
See [Introspection Documentation](https://leonardovida.github.io/drizzle-
|
|
279
|
+
See [Introspection Documentation](https://leonardovida.github.io/drizzle-duckdb/guide/introspection) for all options.
|
|
275
280
|
|
|
276
281
|
## Configuration Options
|
|
277
282
|
|
|
@@ -307,7 +312,7 @@ This connector aims for compatibility with Drizzle's Postgres driver but has som
|
|
|
307
312
|
| Streaming results | Chunked reads via `executeBatches()` / `executeArrow()`; no cursor streaming |
|
|
308
313
|
| Concurrent queries | One query per connection; use pooling for parallelism |
|
|
309
314
|
|
|
310
|
-
See [Limitations Documentation](https://leonardovida.github.io/drizzle-
|
|
315
|
+
See [Limitations Documentation](https://leonardovida.github.io/drizzle-duckdb/reference/limitations) for details.
|
|
311
316
|
|
|
312
317
|
## Examples
|
|
313
318
|
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"module": "./dist/index.mjs",
|
|
4
4
|
"main": "./dist/index.mjs",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
|
-
"version": "1.3.
|
|
6
|
+
"version": "1.3.2",
|
|
7
7
|
"description": "A drizzle ORM client for use with DuckDB. Based on drizzle's Postgres client.",
|
|
8
8
|
"type": "module",
|
|
9
9
|
"scripts": {
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
},
|
|
44
44
|
"repository": {
|
|
45
45
|
"type": "git",
|
|
46
|
-
"url": "git+https://github.com/leonardovida
|
|
46
|
+
"url": "git+https://github.com/leonardovida/drizzle-duckdb.git"
|
|
47
47
|
},
|
|
48
48
|
"exports": {
|
|
49
49
|
".": {
|
|
@@ -72,9 +72,9 @@
|
|
|
72
72
|
"author": "M L",
|
|
73
73
|
"license": "Apache-2.0",
|
|
74
74
|
"bugs": {
|
|
75
|
-
"url": "https://github.com/leonardovida
|
|
75
|
+
"url": "https://github.com/leonardovida/drizzle-duckdb/issues"
|
|
76
76
|
},
|
|
77
|
-
"homepage": "https://github.com/leonardovida
|
|
77
|
+
"homepage": "https://github.com/leonardovida/drizzle-duckdb#readme",
|
|
78
78
|
"files": [
|
|
79
79
|
"src/**/*.ts",
|
|
80
80
|
"dist/*.mjs",
|