Skip to content

v2.4.0 - Prisma compatibility layer for MySQL and PostgreSQL

Latest

Choose a tag to compare

@jeremydaly jeremydaly released this 16 Jun 17:51

New Features

Prisma compatibility layer for both PostgreSQL and MySQL. The new data-api-client/compat/prisma subpath gives you createPrismaPgAdapter() and createPrismaMySQLAdapter(), which return a Prisma 7 driver adapter you hand straight to new PrismaClient({ adapter }). The adapter is thin: it reuses the core client's query, retry, result-formatting, and transaction handling, and adds only what Prisma needs (column-type mapping and Prisma-shaped parameters). (#175)

  • Full query API coverage on both engines, verified by a 179-test audit: CRUD, aggregation and groupBy, the filter operators, pagination and cursors, select/include/omit, nested writes, relation filters, atomic number updates, JSON, Decimal/BigInt/DateTime, PostgreSQL scalar arrays, raw queries, and transactions.
  • Transactions map to the native Data API lifecycle. Interactive $transaction commits and rolls back; nested savepoints are rejected, same as the other layers.
  • @prisma/driver-adapter-utils is an optional peer dependency, so it's only required if you actually use the adapter.

Bug Fixes

These were in the core result and parameter handling, so they also help non-Prisma callers:

  • Array results with hydrateColumnNames: false: array-column values flattened into the row instead of nesting as a single cell. They now nest correctly.
  • Explicit parameter typeHint: a typeHint set on a native-format parameter was dropped before reaching the Data API. It's now honored, so DATE/TIME/DECIMAL/UUID/JSON hints take effect.

Documentation (#176)

  • Reordered the intro to lead with the ORM and query-builder compatibility layers, then raw SQL, then the built-in transactions and retry logic.
  • Replaced the dated "Enabling Data API" walkthrough with links to the current AWS docs, and trimmed the IAM policy to the actions this SDK v3 client actually uses (dropped the deprecated rds-data:ExecuteSql).
  • Documented the ~1 MB per-statement result limit and the lack of server-side pagination, with keyset-pagination guidance.

Migrations (Prisma)

Prisma driver adapters cover the runtime query path only. Prisma's schema engine (migrate, db push, db pull) needs a direct connection the Data API doesn't provide, the same split Neon and PlanetScale have. Point Prisma's migration url at your Aurora cluster endpoint, or generate the SQL offline with prisma migrate diff and apply it over the adapter. See the README for both paths.

Testing

  • Added Prisma integration suites for both engines (test:int:orm:prisma), plus opt-in full-API coverage suites (test:int:orm:prisma:coverage).

Limitations

  • Nested transactions need SQL SAVEPOINTs, which the Data API has no primitive for, so nested transactions throw.
  • The MySQL gaps you'd expect from Prisma still apply (no mode: 'insensitive', no createManyAndReturn, no scalar arrays). They behave exactly as they would on the native mysql2 driver.

Upgrade Instructions

This release is additive and backward compatible. Update the package:

npm install data-api-client@2.4.0