I Have A New Favorite Database Tool

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
if y'all been around for a while you know I've had a trying relationship with Prisma it's one of the best developer experiences for typescript devs working with databases but it doesn't come cheap the performance leaves a lot to be desired the typescript side and the node module Generation stuff can uh be a little Annoying to get right and certainly breaks in fun ways in mono repos I've went to hell and back trying to make Prisma work exactly how I need to in a lot of different places that doesn't mean Prisma is bad it just means Prisma comes with a lot of weight when you use it and because of that there is a lot of energy and excitement around alternatives to Prisma the other one I've explored in the past was kiesley but recently we've been making a bet on drizzle at ping drizzle is an alternative orm to things like Prisma that is focused on being simple minimal abstractions on top of your SQL database even the syntax kinda looks like writing SQL the benefits of having something so much simpler is that integrating it is a lot easier you can change the connection layer so you don't have to you use a native database connection you can just go straight to something like the planet scale HTTP endpoint and now you can run on edge I've been enjoying drizzle a lot although not having docs has been rough and the query syntax wasn't my thing especially when it came to defining relations I don't want to have to think in left joints I'm not smart enough for this stuff I don't I don't know what a left join is okay I do don't don't roast me guys but I'd prefer to not be thinking in SQL all the time when I'm writing my code in typescript and thankfully both of these problems have been addressed the new drizzle release and it's becoming easier and easier to recommend every single day let's take a look at what drizzle's been working on here's the blog post drizzle orm 0.26 is out these are the stars they're at 5K now I want you all to prove that my audience can do big impact I want to see this doubled a week after this video comes out I want this over 10K the links in the top comment click it Go Star drizzle to let them know that you saw us here anyways first big change that they made in this release is relational queries if you're familiar with Prisma this probably looks very familiar you db.query dot the thing users dot find many you say what you want attached to it and it grabs it and here is a user object with the posts attached so simple so nice this is my language this is SQL without the sequel this is what uh dummies like myself need a lot it still supports the old model which is really nice but if you're dumb like me you can set it up correctly this way instead and it doesn't have to be a direct traditional relation with a foreign key you define custom relations with their relations helper so you can make your own relations and bindings this way instead so it's so much cleaner so hyped that they made these changes it makes this much more accessible for people like me the coolest change in here is not just that the new syntax is great it's that drizzle will always make exactly one SQL query so however you write this it will convert it into one query it might be a big query but it will actually run one SQL query for everything you write in this syntax versus Prisma which can do an unknown amount of back and forth when you write a query with a relation in it this is very very performant really cool to see and here's the link to the doodox docs were the number one requested features since day one and yes they now have docs no raindrops those are tears I cried yeah just the the endless memes they can't help themselves let's take a look at this marketing site quick because it is it is beautiful developers love drizzle all of these are actual comments and tweets that they found everything here is a real tweet which is beautiful hilarious I I love the self-awareness in their marketing and branding it's beautiful they forgot to change the copyright for it for the drizzle come on guys actual docs now installation has buttons to all the different things you might want to integrate with which shows you how easy it is to do they even link the MySQL course from planet scale which is cool they show the schema declaration and how this all works one of the really cool things about drizzle versus other Solutions is that your schema is entirely in typescript so you write it with the syntax where you define your tables as values calling this table helper function and then when you want to sync this to your database you point to the drizzle CLI at the file and it reads the typescript and updates the database accordingly so there's no weird schema that exists outside of typescript and they can also use this to make the type definitions that you get when you use it so this serves two roles one is that it defines the schema in the database that is the thing that actually gets written in your database and the other side is that you get the type inference all inside a typescript without some weird compiler step it's really nice and we've been using it a ton at ping you can also infer models to directly off of this if you want to have that type to access in other places that you can pass around and such to it's it's really good generally if you just return the thing like this though the type that comes out is correct so you can infer the type off of your insert user function here instead of having to do an explicit return type because you all know how I feel about explicit return types this is so cool I'm really hyped Prisma is not dead but drizzle is giving us a real reason to reconsider and I will be using drizzle for the foreseeable future in the projects that I make the speed they move at the quality of the team building it the community involvement and generally the height I and a lot of others have around drizzle is real and it's so cool to see the hard work this team's been putting in to make something awesome give it a shot if you haven't already please throw them a star if you want to see how much using something like drizzle on the edge can help with your database performance I'll pin a video here all about database performance in the edge thank you guys as always
Info
Channel: Theo - t3․gg
Views: 116,407
Rating: undefined out of 5
Keywords: web development, full stack, typescript, javascript, react, programming, programmer, theo, t3 stack, t3, t3.gg, t3dotgg
Id: _SLxGYzv6jo
Channel Id: undefined
Length: 5min 46sec (346 seconds)
Published: Wed May 31 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.