light gayami
light gayami
PPrisma
Created by light gayami on 3/24/2025 in #help-and-questions
DB migration does not work on Python Client with Prisma Postgres
I have created a project with prisma postgres for my python application. Following is an example prisma/schema.prisma
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}

generator client {
provider = "prisma-client-py"
interface = "sync"
recursive_type_depth = 5
}

model Post {
id String @id @default(cuid())
created_at DateTime @default(now())
updated_at DateTime @updatedAt
title String
published Boolean
desc String?
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}

generator client {
provider = "prisma-client-py"
interface = "sync"
recursive_type_depth = 5
}

model Post {
id String @id @default(cuid())
created_at DateTime @default(now())
updated_at DateTime @updatedAt
title String
published Boolean
desc String?
}
with the following .env
DATABASE_URL="prisma+postgres://accelerate.prisma-data.net/?api_key=ey...
DATABASE_URL="prisma+postgres://accelerate.prisma-data.net/?api_key=ey...
running prisma db push returns the following error
Error code: P1012
error: Error validating datasource `db`: the URL must start with the protocol `postgresql://` or `postgres://`.

To use a URL with protocol `prisma://`, you need to either enable Accelerate or the Data Proxy.
Enable Accelerate via `prisma generate --accelerate` or the Data Proxy via `prisma generate --data-proxy.`

More information about Data Proxy: https://pris.ly/d/data-proxy

--> prisma/schema.prisma:3
|
2 | provider = "postgresql"
3 | url = env("DATABASE_URL")
|

Validation Error Count: 1
[Context: getConfig]
Error code: P1012
error: Error validating datasource `db`: the URL must start with the protocol `postgresql://` or `postgres://`.

To use a URL with protocol `prisma://`, you need to either enable Accelerate or the Data Proxy.
Enable Accelerate via `prisma generate --accelerate` or the Data Proxy via `prisma generate --data-proxy.`

More information about Data Proxy: https://pris.ly/d/data-proxy

--> prisma/schema.prisma:3
|
2 | provider = "postgresql"
3 | url = env("DATABASE_URL")
|

Validation Error Count: 1
[Context: getConfig]
how to possibly solve this? The Docs have nothing of substance and no source to solve this issue. Or is there a way to get a direct URL for the same?
5 replies