3 ms·
How does this compare to TypeORM? First time hearing about this project, and it looks interesting
by CraftThatBlock 7y ago
How does this compare to TypeORM? First time hearing about this project, and it looks interesting
- g_delgado14 7y ago- https://www.prisma.io/docs/understand-prisma/prisma-in-your-stack/is-prisma-an-orm https://www.prisma.io/docs/understand-prisma/prisma-in-your-... - https://www.prisma.io/docs/understand-prisma/data-modeling#data-modeling-with-orms https://www.prisma.io/docs/understand-prisma/data-modeling#d...
- nikolasburk 7y agoNikolas from the Prisma team here. The most important thing to note here is that Prisma Client is not an ORM! [1] Prisma doesn't map classes to tables as ORMs do and therefore doesn't suffer from the object-relational impedance mismatch. Prisma Client queries return plain old JS objects, which makes it really easy to reason about queries and returned data. Prisma also has a query engine [2] that's implemented in Rust. This is being developed separately from the TS/JS layer above (so that in the future Prisma can support other languages as well). Prisma also generally provides stronger type safety than TypeORM. For example, you get full type safety even for partial queries [3], you can find an example for what this looks like in this video [4]. Let me know if you have more questions about this :) [1] https://www.prisma.io/docs/understand-prisma/prisma-in-your-stack/is-prisma-an-orm https://www.prisma.io/docs/understand-prisma/prisma-in-your-... [2] https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client/query-engine https://www.prisma.io/docs/reference/tools-and-interfaces/pr... [3] https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client/advanced-usage-of-generated-types https://www.prisma.io/docs/reference/tools-and-interfaces/pr... [4] https://youtu.be/LggrE5kJ75I?t=40 https://youtu.be/LggrE5kJ75I?t=40
- pvg 7y agoIn the first document, all the links in the comparison table link back to the document itself instead of the documentation for the things mentioned.
- nikolasburk 7y agoThanks, will get that fixed!
- Scarbutt 7y agoand therefore doesn't suffer from the object-relational impedance mismatch. Prisma Client queries return plain old JS objects Is that really true? the data models are still different, relations vs js objects. Maybe you meant to say that Prisma hides and abstracts away the relational model, but the impedance mismatch is still there.
- jbverschoor 7y agoYou still map objects to relations.
- sorenbs 7y ago- ORMs traditionally map classes to tables. - Prisma maps queries to structural types. This is a key distinction that the community will need to spend some time to really get an intuitive understanding for. I think you will realise that many of the problems we discovered when using classic ORMs (often described as impedance mismatch) does not apply to Prisma. But there are sure to be other problems that we will discover over time. I am looking forward to shake this out together with the broader community over the coming years.
- heymartinadams 7y agoNikolas, video [4] is still set to “private”, fyi.
- nikolasburk 7y agoAh thanks for catching this Martin, fixed!
- CraftThatBlock 7y agoVery interesting! I do usually prefer using a query builder or raw SQL over an ORM, and will definitely check this one
- latchkey 7y agoMikro ORM [1] is the new hot sauce over TypeORM and it is fantastic. [1] https://mikro-orm.io/ https://mikro-orm.io/