drizzle-team / drizzle-team/drizzle-orm

[BUG]: D1 too many SQL variables at offset

Open
#2,479 15 comments 37 reactions 0 assignees View on GitHub
driver/d1 enhancement
Dominant language
TypeScript
Stars
35.8k
Forks
1.6k
Avg merge
2d 7h
Merged PRs (30d)
4

Description

### What version of `drizzle-orm` are you using?

0.31.2

### What version of `drizzle-kit` are you using?

0.22.1

### Describe the Bug

When running an `insert()` query with more than 32 values, D1 throws error: `too many SQL variables at offset`.

### Expected behavior

Expect Drizzle to chunk the inserts [similar to Prisma](https://github.com/prisma/prisma/issues/23743#issuecomment-2124444662)

### Environment & setup

```ts
const sqlite = new Database("db.sqlite");

const db = drizzle(sqlite, { schema });

const books = new Array(35).fill({}).map((b, i) => ({
id: i.toString(),
title: "The Great Gatsby",
description: "A book about a rich guy",
}));

await db.insert(schema.books).values(books);
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.