Which means "auto_register=True" #329
Answered
by
RobertCraigie
felinto-dev
asked this question in
Q&A
-
https://prisma-client-py.readthedocs.io/en/stable/ async def main() -> None:
db = Prisma(auto_register=True)
await db.connect() from prisma import Prisma
db = Prisma()
await db.connect() I look the documentation but I can't find any explanation. Could someone explain me? |
Beta Was this translation helpful? Give feedback.
Answered by
RobertCraigie
Mar 10, 2022
Replies: 1 comment 1 reply
-
Sorry that isn't clear enough I'll try and make it easier to find in the future. That parameter means that you can query from model classes, for example: from prisma import Prisma
from prisma.models import User
prisma = Prisma(auto_register=True)
await prisma.connect()
# this line would fail if auto_register was False or omitted
user = await User.prisma().create(
data={
'name': 'Robert',
},
) This is required as some people may want to have multiple |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
felinto-dev
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sorry that isn't clear enough I'll try and make it easier to find in the future.
That parameter means that you can query from model classes, for example:
This is required as some people may want to have multiple
Prisma
instances at once.https://prisma-client-py.readthedocs.io/en/stable/reference/model-actions/#registering-a-client-instance