do you have experience with the python prisma client?

hay gang, has anyone used the python client for prisma? what's your take? https://github.com/RobertCraigie/prisma-client-py a bit of context: we have a terribly maintained MongoDB at work and I'm searching for a way out, adding prisma would be a big jump in the right direction, any other suggestions are welcome
GitHub
GitHub - RobertCraigie/prisma-client-py: Prisma Client Python is an...
Prisma Client Python is an auto-generated and fully type-safe database client designed for ease of use - GitHub - RobertCraigie/prisma-client-py: Prisma Client Python is an auto-generated and fully...
13 Replies
Yatochka
Yatochka•17mo ago
Im using it for my discord bot written in python. It doesn't support some things yet, but works for me just fine.
robotkutya
robotkutya•17mo ago
like what...? and what's the workaround if you run into something that doesn't work... I guess you can always write native queries, but how do you avoid things getting messy?
Yatochka
Yatochka•17mo ago
Personally, I faced the issue with composite-types They aren't supported yet I used relationships to resolve this And it works just fine
Yatochka
Yatochka•17mo ago
GitHub
Prisma Client Python • RobertCraigie
This project is used to track the Prisma Client Python roadmap
robotkutya
robotkutya•17mo ago
hmmm... that's kind of a big one in mongo land but to be honest, most of our issues are because we are modeling relational data
Yatochka
Yatochka•17mo ago
Yea
robotkutya
robotkutya•17mo ago
so moving away from it would be good so you basically just created a $lookup and then embed it via a query when needed?
Yatochka
Yatochka•17mo ago
I created a onetoone relation from guild to guildsettings, and yes, I just include it when needed.
robotkutya
robotkutya•17mo ago
*populate I think is the correct technical term, so basically a join gotcha thanks! 🙂
cyremur
cyremur•16mo ago
FWIW The tooling for more complex stuff in terms of editor suggestions isn't quite there yet and I had like a weird thing going on with nested queries:
posts = await prisma.post.find_many(
include={
"user": {
"include": {
"userData": {
"take": 1,
"order_by": {
"timestamp": "desc"
}
}
},
}
}
)
posts = await prisma.post.find_many(
include={
"user": {
"include": {
"userData": {
"take": 1,
"order_by": {
"timestamp": "desc"
}
}
},
}
}
)
^ Query for loading all posts with the last version of the user profile. SOMEHOW this works, but looks super shady to me since the first include is an args name and the second a string... if you're operating on simpler queries and don't mind falling back to raw sql occasionally, it's kinda nice though. (This is on 0.7.1, might be better now)
Brendonovich
Brendonovich•16mo ago
I think the first include = { is a named parameter whereas the next "include": { is a dict key
cyremur
cyremur•16mo ago
that does make sense but yeah, that's one of the places where it's not as smooth as typescript prisma also forget editor suggestions for nested queries
robotkutya
robotkutya•16mo ago
cool thanks for the input!