Skip to content

Commit

Permalink
- remove Preview feature block
Browse files Browse the repository at this point in the history
- reorder adapter option in Prisma Client reference
- Update Neon link used in Prisma Client reference
- link to driver adapter from PlanetScale guide-- apply feedback
  • Loading branch information
ruheni committed Nov 2, 2023
1 parent be7275d commit 2ea0195
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 40 deletions.
18 changes: 9 additions & 9 deletions content/200-concepts/100-components/drivers.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
title: 'Drivers'
metaTitle: 'Drivers'
metaDescription: 'Learn how Prisma connects to your database using the built-in drivers and how you can use Prisma along with other JavaScript database drivers using driver adapters (Preview)'
preview: true
tocDepth: 4
---

Expand All @@ -14,21 +13,22 @@ One of Prisma Client's components is the [Query Engine](./prisma-engines/query-e

## Driver adapters

Prisma Client can connect and run queries against your database using other JavaScript database drivers using **driver adapters**. Adapters act as _translators_ between Prisma Client and the JavaScript database driver.
Prisma Client can connect and run queries against your database using JavaScript database drivers using **driver adapters**. Adapters act as _translators_ between Prisma Client and the JavaScript database driver.

Prisma will use the Query Engine to transform the Prisma Client query to SQL and run the generated SQL queries via the JavaScript database driver.

![Query flow from the user application to the database using Prisma Client and driver adapters](./images//drivers/qe-query-engine-adapter.png)

Prisma will use the Query Engine to transform the Prisma Client query to SQL and run the generated SQL queries via the JavaScript database driver.
### Serverless driver adapters

Prisma maintains the following driver adapters:
- [Neon](/guides/database/neon#how-to-use-the-neon-serverless-driver-with-prisma-preview)
- [PlanetScale](/guides/database/planetscale#how-to-use-the-planetscale-serverless-driver-with-prisma-preview)

- Serverless driver adapters:
### Database driver adapters

- [Neon](https://github.com/prisma/prisma/tree/main/packages/adapter-neon)
- [PlanetScale](https://github.com/prisma/prisma/tree/main/packages/adapter-planetscale)
- [Turso](/guides/database/turso#connect-and-query-your-primary-database)

- Database driver adapters:
- [Turso](https://github.com/prisma/prisma/tree/main/packages/adapter-libsql)
### How to use driver adapters

To use this feature:

Expand Down
6 changes: 3 additions & 3 deletions content/300-guides/050-database/850-planetscale.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ For a more detailed example, see the [Getting Started guide for PlanetScale](/ge

The [PlanetScale serverless driver](https://planetscale.com/docs/tutorials/planetscale-serverless-driver) provides a way of communicating with your database and executing queries over HTTP.

You can use Prisma along with the PlanetScale serverless driver using a [driver adapter](/concepts/components/drivers#driver-adapters) <span class="concept"></span>. A driver adapter allows you to use a different database driver to communicate with your database from the default driver Prisma provides.
You can use Prisma along with the PlanetScale serverless driver using the [`@prisma/adapter-planetscale`](https://www.npmjs.com/package/@prisma/adapter-planetscale) driver adapter. The driver adapter allows you to communicate with your database over HTTP.

<Admonition>

Expand All @@ -256,12 +256,12 @@ npx prisma generate

Ensure you update the host value in your connection string to `aws.connect.psdb.cloud`. You can learn more about this [here](https://planetscale.com/docs/tutorials/planetscale-serverless-driver#add-and-use-the-planetscale-serverless-driver-for-javascript-to-your-project).

</Admonition>

```bash
DATABASE_URL='mysql://johndoe:[email protected]/clear_nightsky?sslaccept=strict'
```

</Admonition>

Install the Prisma adapter for PlanetScale, PlanetScale serverless driver and `undici` packages:

```sh
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,34 @@ This section describes the `PrismaClient` constructor and its parameters.

- Parameters are validated at runtime.

### <inlinecode>adapter</inlinecode>

Defines an instance of a [driver adapter](/concepts/components/drivers#driver-adapters). See also [Drivers](/concepts/components/drivers) <span class="concept"></span>.

This is available from version 5.4.0 and newer.

This feature is currently in Preview behind the `driverAdapters` feature flag.

#### Example

The example below uses the [Neon driver adapter](/guides/database/neon#how-to-use-the-neon-serverless-driver-with-prisma-preview)

```ts
import { Pool, neonConfig } from '@neondatabase/serverless'
import { PrismaNeon } from '@prisma/adapter-neon'
import { PrismaClient } from '@prisma/client'
import dotenv from 'dotenv'
import ws from 'ws'

dotenv.config()
neonConfig.webSocketConstructor = ws
const connectionString = `${process.env.DATABASE_URL}`

const pool = new Pool({ connectionString })
const adapter = new PrismaNeon(pool)
const prisma = new PrismaClient({ adapter })
```

### <inlinecode>datasources</inlinecode>

Programmatically overrides properties of the `datasource` block in the `schema.prisma` file - for example, as part of an integration test. See also: [Data sources](/concepts/components/prisma-schema/data-sources) <span class="concept"></span>
Expand Down Expand Up @@ -123,34 +151,6 @@ const prisma = new PrismaClient({
})
```

### <inlinecode>adapter</inlinecode>

Defines an instance of a [driver adapter](/concepts/components/drivers#driver-adapters). See also [Drivers](/concepts/components/drivers) <span class="concept"></span>.

This is available from version 5.4.0 and newer.

This feature is currently in Preview behind the `driverAdapters` feature flag.

#### Example

The example below uses the [Neon driver adapter](/guides/database/neon#how-to-use-the-neon-serverless-driver-with-prisma-preview)

```ts
import { Pool, neonConfig } from '@neondatabase/serverless'
import { PrismaNeon } from '@prisma/adapter-neon'
import { PrismaClient } from '@prisma/client'
import dotenv from 'dotenv'
import ws from 'ws'

dotenv.config()
neonConfig.webSocketConstructor = ws
const connectionString = `${process.env.DATABASE_URL}`

const pool = new Pool({ connectionString })
const adapter = new PrismaNeon(pool)
const prisma = new PrismaClient({ adapter })
```

### <inlinecode>log</inlinecode>

Determines the type and level of logging. See also: [Logging](/concepts/components/prisma-client/working-with-prismaclient/logging) <span class="concept"></span>
Expand Down

0 comments on commit 2ea0195

Please sign in to comment.