You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Prisma Python Client generates a reference to fields.Base64 in the _builder.py file, but the Base64 type is not defined in the generated fields.py. This causes an AttributeError: module 'prisma.fields' has no attribute 'Base64' during prisma generate.
The Prisma Python Client should generate the Base64 type in fields.py or provide proper handling for the Bytes type without generating a broken reference.
Prisma information
I was getting this same error except it occurred when I ran from prisma import Prisma in a Python program or repl after generating the client one time. Then the error would occur each time I tried to regenerate with prisma generate after that. And the prisma_cleanup module didn't help either because it would give the error RuntimeError: The given package does not appear to be a Prisma Client Python package.
I was able to fix this by reinstalling prisma and specifying recursive_type_depth = 5 for the generator in my schema.prisma. The warnings about Mypy lead me to try with this set to -1, but that is when I started getting the error about fields.Base64. I could verify that generating with recursive_type_depth = 5 gives a fields.py file containing only the following line instead of the version of fields.py that does not import from ._fields or base64. from ._fields import *
Here is the generator in my schema.prisma file with the fix:
So it turns out the issue was with using python "prisma-client-py" as the provider, if I used js "prisma-client-js"everything worked out fine. I know that isn't much of a fix but its better than punching your desk for 3 hours (my hands hurt).
Bug description
The Prisma Python Client generates a reference to
fields.Base64
in the_builder.py
file, but theBase64
type is not defined in the generatedfields.py
. This causes anAttributeError: module 'prisma.fields' has no attribute 'Base64'
duringprisma generate
.How to reproduce
Steps to reproduce the behavior:
Expected behavior
The Prisma Python Client should generate the Base64 type in fields.py or provide proper handling for the Bytes type without generating a broken reference.
Prisma information
generator client {
provider = env("PRISMA_CLIENT_PROVIDER")
}
datasource db_postgres {
provider = "postgresql"
url = env("DATABASE_URL")
}
model Example {
id Int @id @default(autoincrement())
data Bytes
}
Environment & setup
Name: prisma
Version: 0.15.0
Name: prisma-client
Version: 0.2.1
The text was updated successfully, but these errors were encountered: