Prisma: Modern Database Tooling with Johannes Schickling


Honest welcome back to the show. It's great to be back under so thanks so much for having me. Of course you run. PRISMA and PRISMA is involved in workflows for accessing data. Can you describe the AP? Is that sit between the front and the back end database layer, and where PRISMA fits in sure so I think that's a pretty complex questions. It's always. Always depends on what your application architecture looks like, and there's so many angles to take does feed for example, take a more mortar jam, stag texture, or if you take a micro services architecture, the onset is always depends. What's always the same as if you build application that requires state of assistance? Then chances are you're using database and how PRISMA fits into. Is that it tries to help application developers built applications more easily was working with the databases so typically that means you're using a part of PRISMA. What's called the prisoner client that sits typically in your application server? That's typically an API server and talks to your database. Typically, this part of the stack is known as an or layer or data access layer. PRESI-, in particular is not an Orem can talk about that separately. The pretty nuanced topic, but prison up to. The main function is to serve to access state. I'm more easily in your application language. Can you talk about that in more detail? Like? Why would I need a additional layer of access I? Mean I think in general? I if I'm sitting on the front end and I want to access the database I m hitting some service that services talking to a database and the service is requesting the data from the database. Why do I need prisma to help out with that database access so this setup just to recap one more time, so you have your fronton application. Let's say you have reactive of you up on the other end. You have database. Let's say you have a more traditional postures, my sequel database, but would also apply to same for more modern. Modern Dynamo DB etc, and then typically have this middle tier that's let's say an API server, and where you would use prisma for is just having an easier time building your API server in order to talk to the database, so let's say you're using pastas. The most barebones thing you could do is implementing your Api Server and just writing implementing your points, or let's say rebuilding a graph gals over implementing overs, and then just talking directly to the database by writing raw sequel. Curry's and that works, but that comes also was some problems. Problems typically in terms of productivity, and does not quite abstraction level that you want as an application developer to be productive and confident in what you're writing the same way as fronton applications are built through abstraction layers. Let's say react angular view. It's the same on the back end that you also want more application at U. Matic obstruction layer for away you talking to the database, and historically there's been many forms of the most common one is in Orem, and they're on more modern ways of how you build a better abstraction on top. Top of fear database for data access, and that's a pattern that implementing was prisma that to be referred to as careerbuilder. Can you explain in more detail? What is the difference between a query builder and an OEM right? So that comes down to the way how you're thinking about these application patterns, an Orem stands for object, relational knepper, and the idea behind an orum is mapping a typically a database table to a class in typically object oriented programming language, and this is a pretty intuitive model and is widely used in tons of. The most prominent one of be being active record as part of friggin rails, but there tons of other ones as well and the Java world. There's hibernate and the idea there you have tons of tables in your database, and you want to map that somehow and Julia programming language and your programming language. You're typically working with classes as opposed to a career rebuilder with looks more like sequel way, but maps you sequel statements into statements in your programme language and the difference really come down to how much flexibility and control you need, but they're tons of downsides of or and that as Good more widely used became more and more well known, so there's a great block posed called the Vietnam of computer science, which is all about or ems and the problems behind orum's most importantly one thing called the object relational impedance mismatch. Talks about the problems of mapping databases database tables to objects where he's just a big amount of oven, impedance mismatch, and the way around that is that you should think about the craziest that you're writing a database instead of obsessing too much about the classes and objects, and your curry should really determine the shape of the data. You're getting back in the same way as the British striking analogy to how gruff LDL's was the sort of pattern where draft, but L. is all about the quarry writing that you need in your components, and it's a pretty similar pattern that you're now applying the way how you do. They access on the back end. If I was to set up PRISMA for Miami application. What would the life of a query look like and the structure of a query look like? So what you'd be using concretely, there is prisoner. Database took. And what you would use to career database is a part of prisma called the PRISMA Klein's. The prisoner client is basically just a Java script library that you installed installed from NPR. And you're. Writing that query ones in your coat. One great advantage is that it's fully type safe by leveraging type script, so you're writing that query and then strode run times when your application is deployed. That code gets invokes that under the hood generates a database dependent query, typically a sequel query, but as we were supporting of databases, swell could generate dynamo queries, Atra, and these queries are centered underlying database, and the data's returned, and then returned injury application code. Got It and. What the difference between using PRISMA AND USING GRAPH KUNAL! So, it's a really two fundamentally different technologies for different use cases I. think a good way to think about is where into application stack. These technology said so graphic. L. is typically used for fronton applications to talk back end up locations whereas prisoners specifically the prison. My client is used for typically your backup location to talk to your database so analogous in this way, but typically the different layers of the stack. However, it always depends was newer approaches like the jam stack your friends and education can statically directly talk to

Coming up next