drizzle-team / drizzle-orm

Headless TypeScript ORM with a head. Runs on Node, Bun and Deno. Lives on the Edge and yes, it's a JavaScript ORM too 😅
https://orm.drizzle.team
Apache License 2.0
24.3k stars 626 forks source link

[FEATURE]: Support the Batch API on the Neon adapter #1802

Open dinwwwh opened 9 months ago

dinwwwh commented 9 months ago

Describe what you want

In @neondatabase/serverless handle transactions like this

import { neon } from '@neondatabase/serverless';
const sql = neon(process.env.DATABASE_URL);
const showLatestN = 10;

const [posts, tags] = await sql.transaction([
  sql`SELECT * FROM posts ORDER BY posted_at DESC LIMIT ${showLatestN}`,
  sql`SELECT * FROM tags`,
]);

Currently, Drizzle does not support transactions on neon adapters. However, if Drizzle supports batch on neon, it can bridge this gap.

AsyncBanana commented 9 months ago

Postgres.js also implements a very similar API