I have a more conceptual question. Let's say there...
# orm-help
l
I have a more conceptual question. Let's say there was a really nice ORM for Javascript. What would Prisma give you over a normal ORM, since, for your public GraphQL resolver implementations you just end up using the Prisma bindings which are basically like an ORM. I'm not really understanding why Prisma is GraphQL based, if you never end up actually directly utilizing the GraphQL aspect of Prisma in the end?
n
Hey 👋 that’s a great question! The binding API in fact uses the Prisma GraphQL API under the hood. Each binding function that’s invoked generates a GraphQL query (or mutation/subscription) being sent to the Prisma API. In that context, it’s key to understand the role of the
info
object which is passed along to the binding function. The
info
object carries the selection set of the incoming query, allowing Prisma to efficiently resolve the query!
j
Still trying to understand bindings so I am a dumb person with you lol
l
OK so you're saying that, in the various implementations of my public resolvers, I am able to use varying
info
parameters to utilize the GraphQL nature of Prisma's CRUD, such that I'm getting back just the structure I need. Hence the GraphQL. Where as with some ORM, I'm likely always getting back full models.
👍 1
n
@Jscott388 What’s your main issue understanding bindings right now?
I am able to use varying
info
parameters to utilize the GraphQL nature of Prisma’s CRUD, such that I’m getting back just the structure I need. Hence the GraphQL.
Exactly!
đź’Ż 1
l
@nikolasburk Great answer. Thanks.
🙌 1
n
Where as with some ORM, I’m likely always getting back full models.
Fetching full models is indeed a common approach when implementing your resolvers with a conventional ORM (or even when directly accessing the DB). It’s basically the “easiest” way to get your GraphQL server to work, but it entails lots of boilerplate and and also is inefficient because you’re overfetching most of the time (in those cases where clients don’t request all the fields of a type).
j
Understanding the whole concept of it all. I understand the basic of Graphql, but I don't understand the terminology of Bindings. Confused on the structure of the server setup. You have the database, then you have the src folder.
n
The whole setup definitely can be overwhelming at first, 100% agree! @Jscott388
Confused on the structure of the server setup. You have the database, then you have the src folder.
Think of it that way. Your server is divided into two layer: API (or application) layer and database later. Each layer has its own GraphQL API and the API layer builds on top of the database layer by using bindings. The API layer is implemented in
src
, the database layer is configured in
database
.
Does that make more sense? Do you have any concrete questions? @Jscott388 Happy to help 🙂
j
Yeah I will. I think in general I am doing what I need to do as far as setting up everything. I am able to make queries and mutations. As far as deploying and connecting to a database, I need to figure out. I want to separate the database and use RDS if mongodb connector isn't out in time. I want to do a serverless approach. Since my records are updated every two hours, I don't feel the need to run a docker container 24/7.
I am doing a real estate site, taking a whole new approach than what I used too. I have to use a real estate standard using RETS (not rest) to obtain the data, then I have to convert it into a readable format, then save it to a database. So I need to make lambda scripts that will do my mutations on the fetched data. So there could be 1000 records at a given time. So I been able to do it effectively directly pulling it from the source, inserting the record directly into mongo. So curious to see how I can use graphql to seed my data via a lambda function.
l
@Jscott388 If you were building your site with a traditional ORM, would you have a conceptualization of how to build your product?
I am using this a base to build out my data structure. The problem is the real estate area I am in is no where close to this. So I have to map everything. Some of the fields are confusing. For example, SubdivisionName is the field LM_Char50_4 that comes in.
There is no API. So I basically have to build one, but I am doing it graphql way this go around instead of a rest api.
l
I can't really speak to or try to comprehend your use-case, but I can try to help conceptualize Prisma if that is the problem.
j
Basically it handles my database logic