This is why I love drizzle ORM

  Рет қаралды 13,117

Web Dev Cody

Web Dev Cody

Күн бұрын

Become a YT Members to get extra perks!
www.youtube.co...
My Products
🏗️ WDC StarterKit: wdcstarterkit.com
📖 ProjectPlannerAI: projectplanner...
🤖 IconGeneratorAI: icongeneratora...
Useful Links
💬 Discord: / discord
🔔 Newsletter: newsletter.web...
📁 GitHub: github.com/web...
📺 Twitch: / webdevcody
🤖 Website: webdevcody.com
🐦 Twitter: / webdevcody

Пікірлер: 81
@trebturner
@trebturner 2 ай бұрын
Love the shorter and more specific videos!
@h4nto772
@h4nto772 2 ай бұрын
no matter how fast we are, your wife will always be first
@fortunethedev
@fortunethedev 2 ай бұрын
😂😂😂love this
@chikin6358
@chikin6358 2 ай бұрын
Drizzle allows you to select only what you like inside the select. select({posts}).from(…. Or be even more specific with select({id: posts.id}).from(…. Which is a bit nicer on your db. Great demo
@joaquimley
@joaquimley 2 ай бұрын
Exactly, maybe the idea was to keep the video short (which is great btw), but for these kind of quick tips, it might make sense to do it the right way as a lot of people especially juniors will use this as a tutorial and not a demo. Thanks for the content.
@lucasfranzolin
@lucasfranzolin 2 ай бұрын
srtaight to the point!! I'm loving the path this channel has taken, good stuff bro!!
@thimodev
@thimodev 2 ай бұрын
Being able to exactly specify which fields you want back from your query in your select makes this so so powerful, saving payload size and not sending data to the frontend (or in this case the results variable) with typescript understanding it is soooooooo good
@BenMargolius
@BenMargolius 2 ай бұрын
From a practical standpoint does this really save that much data, I feel like data is generally on the kb order of magnitude, and sending data over the wire has generally not been a limiting factor in the speed of my app.
@azizsafudin
@azizsafudin 2 ай бұрын
@@BenMargoliusit’s not a trivial amount at scale
@SeibertSwirl
@SeibertSwirl 2 ай бұрын
Good job babe!!!! First yeaaaaaa 👸🏽
@WebDevCody
@WebDevCody 2 ай бұрын
Thanks my number one!
@stanleychukwu7424
@stanleychukwu7424 2 ай бұрын
i swear, i never new you were his wife.. Good for you guys, i'm getting married next year too, i can't wait
@damjandjordjevic1994
@damjandjordjevic1994 2 ай бұрын
@@stanleychukwu7424 She literally comments on every single one of his videos. Pretty cool 😎
@Alex1611AD
@Alex1611AD 20 күн бұрын
This is so wholesome
@my_yt666
@my_yt666 2 ай бұрын
Prisma support this easily without a sweat. Where it lacks a bit are advanced usages of aggregates.
@WebDevCody
@WebDevCody 2 ай бұрын
Thanks for letting me know
@maelstrom7144
@maelstrom7144 2 ай бұрын
I've tried Drizzle but I struggled a LOT with the typing. You can infer a type from a schema but infering types from queries (even more when doing joins) is a big mess to me. Would love to see a video about that!
@kashnigahbaruda
@kashnigahbaruda 2 ай бұрын
Prisma has been able to do that for years. In a much simpler way (imo) too.
@Prince_515
@Prince_515 2 ай бұрын
What keyboard are you using? It sounds really nice
@kaansal9523
@kaansal9523 2 ай бұрын
I actively use SQL for work and I always struggled using ORM's like Entity Framework etc. First time in my life I saw a ORM which is exactly looks same to SQL and very easy to use for SQL Experienced person like me. Thank you for the video!
@TaohidKhan-ut6gf
@TaohidKhan-ut6gf 2 ай бұрын
Make a crash course on complex sql query using drizzle ORM. Love to see your contents
@loorinho
@loorinho 2 ай бұрын
Much love as always from Uganda "mentor"...
@WebDevCody
@WebDevCody 2 ай бұрын
Thanks man
@nicolasramos7084
@nicolasramos7084 2 ай бұрын
I'm loving Drizzle for querying. Now I'd truly love a tutorial on how to handle migrations on a project with Drizzle and Supabase. Still trying to wrap my head around it
@fottymutunda6320
@fottymutunda6320 2 ай бұрын
I'd love to see the actual generated query
@rod6722
@rod6722 2 ай бұрын
I like how, contrary to Prisma, everything is still in TypeScript.
@rico454
@rico454 2 ай бұрын
Which part of prisma isn’t available in TS?
@rod6722
@rod6722 2 ай бұрын
@@rico454 In Prisma you define your schemas in a .prisma file, which is not TypeScript. While in Drizzle you do it in .ts files.
@rico454
@rico454 2 ай бұрын
@@rod6722 oh I see what you mean
@rico454
@rico454 2 ай бұрын
@@rod6722 I guess it comes down to personal preference tbf. The syntax in prisms schema files look way cleaner than creating a schema using TS for drizzle. Plus you don’t actively use the schema file anyways, so as long as the rest of prisma functionality is in TS, then it’s good. And again, it’s all personal preference
@simonhylander7489
@simonhylander7489 7 күн бұрын
Can you talk about how you like to structure your API's data layer. Coming from java I have been enforced to use service/repository patterns for a long time but I'm unsure if I actually like it for nodejs
@MirkoVukusic
@MirkoVukusic 2 ай бұрын
personally, the day I moved from Prisma to Drizzle was when I inspected generated sql queries with some joins. Prisma generated several db queries and joined them "internally". Drizzle creates a single db query. There might be technical explanation why this is not bad, but it goes against all my believes of handling relational databaes and I simply cannot stand it innmy code. And drizzle magic sql `` is amazing
@DaviMartins99
@DaviMartins99 2 ай бұрын
The API looks exactly like Doctrine (PHP) which looks exactly like Hibernate (Java). Cool video :)
@codingwithjamal
@codingwithjamal 2 ай бұрын
I just started using drizzle and turso for my new project and it makes using sqlite so much better in typescript
@DaveMacpherson
@DaveMacpherson 2 ай бұрын
Hey there...love the vids. A question tho...I took a look at your implementation of "database" in your SAAS project on github and was wondering why you stored the db instance in a global variable (. (global as any).database=....) when in dev mode but not in production? What's different about dev mode that makes it a good idea to do this?
@WebDevCody
@WebDevCody 2 ай бұрын
In dev mode every time you save a file it’ll create a new db connection and it ends up saturating the db connection limit
@DhanushkaC
@DhanushkaC 2 ай бұрын
Don’t we need to order desc to the query to make sure we are getting latest 10 posts?
@WebDevCody
@WebDevCody 2 ай бұрын
Yes I forgot that I think
@giandenorte
@giandenorte 2 ай бұрын
nice vid! I'm wondering what recording app you use to have rectangle video of yourself on the side
@Consignion
@Consignion 2 ай бұрын
Don't know how this works in drizzle but would it not be preferable to only select the posts directly in the query rather than fetching all columns and then essentially filtering out the columns?
@Fiercesoulking
@Fiercesoulking 2 ай бұрын
This is very similar to C# LINQ and a lot of ORMs for it like core or NHibernate(also java). The only thing I always worry about it how much this expose the database
@crab-cake
@crab-cake 2 ай бұрын
drizzle orm is one of the few javascript libraries that deserves the hype. it's actually good. unlike everything else in that ecosystem that has hype and is not very good.
@Zero-nh4ke
@Zero-nh4ke 2 ай бұрын
Which theme you are using in ur Code Editor ? that’s looking cool
@WebDevCody
@WebDevCody 2 ай бұрын
A custom one, it might be made public
@Zero-nh4ke
@Zero-nh4ke 2 ай бұрын
@@WebDevCody Do it 😎 I really wanna use in mine editor 🙏
@FranFiori94
@FranFiori94 2 ай бұрын
Ummm, how did you not know how to do this in Prisma? It's been there forever
@WebDevCody
@WebDevCody 2 ай бұрын
Writing raw queries in prisma isn’t the same as using a sql builder that drizzle provides.
@AdityaRaj-lj5wf
@AdityaRaj-lj5wf 2 ай бұрын
Hey cody, Nice tutorial man!!. Wanted to ask what was the tool which allowed you to see the object structure of return beforehand?
@WebDevCody
@WebDevCody 2 ай бұрын
Typescript you mean?
@AdityaRaj-lj5wf
@AdityaRaj-lj5wf 2 ай бұрын
@@WebDevCody ohk Gotcha!
@hannad
@hannad Ай бұрын
I m having a terrible time with drizzle migrations. there is no way to rollback a migration at the moment. the only way is to update/edit migration files or drop database. no one is covering these aspects of a production application.
@WebDevCody
@WebDevCody Ай бұрын
They are currently working on a rollback for migrations. Currently the approach is to revert your scheme of file and generate another migration script and then apply it to revert the changes.
@peterluke9392
@peterluke9392 2 ай бұрын
Prisma does this already 😅 I am not learning another ORM
@kumardeepanshu8503
@kumardeepanshu8503 2 ай бұрын
Do you feel any speed difference between pirsma and drizzel ?
@jens-mikaelstjernberg1037
@jens-mikaelstjernberg1037 2 ай бұрын
Hey Cody, could you help me with an issue? I'm trying to set up drizzle with aws rds in postgres, but when I'm trying to push my tables, drizzle can't find my region, even though they are inside the DATABASE, SECRET_ARN and RESOURCE_ARN env variables?
@WebDevCody
@WebDevCody 2 ай бұрын
I’m not too sure, did you set your database as public and allow access from your ip in your security group?
@reversetcp
@reversetcp 2 ай бұрын
u can do this in prisma no problem
@pixelsbyme
@pixelsbyme 2 ай бұрын
What theme is this?
@rolandmurru6568
@rolandmurru6568 2 ай бұрын
I dont know if to use drizzle or SQL somehow'?
@myonlylovejesus887
@myonlylovejesus887 2 ай бұрын
hey can you say the name of the theme please?
@jackjsy
@jackjsy 2 ай бұрын
Think this has been possible in prisma since day 1 no? but you can just use the regular TS stuff, dont need to use raw sql, but you can if you want I guess (edit: or is this whole video just bait to get prisma users to interact, if so, nicely done)
@WebDevCody
@WebDevCody 2 ай бұрын
Writing raw queries inside a template literal doesn’t compare to using a sql builder with type safety. Maybe I’m missing something?
@jackjsy
@jackjsy 2 ай бұрын
@@WebDevCody yeah agreed, but you wouldnt do this in a template literal, super simple with just regular prisma syntax
@ardianhotii
@ardianhotii 2 ай бұрын
What about this , would this give the same result? : import { PrismaClient } from '@prisma/client'; const prisma = new PrismaClient(); async function getRecentPublicPostsByUserId(userId: number) { const results = await prisma.post.findMany({ where: { userId: userId, Group: { isPublic: true, }, }, include: { Group: true, }, take: 10, // Limit to 10 results orderBy: { id: 'desc', }, }); return results.map(result => ({ ...result, gf_posts: result })); }
@jovincebrillantes1042
@jovincebrillantes1042 2 ай бұрын
Laravel's Eloquent is still probably the best ORM I've used, but I might give drizzle a try. Prisma is giving me headaches...
@kisaki345
@kisaki345 2 ай бұрын
bring back bearded theme stained blue , i can't read
@deepjyotideb1173
@deepjyotideb1173 2 ай бұрын
Anyone know what keyboard he uses? It sounds sooo good.
@shockgalaxy9849
@shockgalaxy9849 2 ай бұрын
I believe its a FunKey app for macbook
@brunomorales9200
@brunomorales9200 2 ай бұрын
I can’t keep up with all these js frameworks
@yassinesafraoui
@yassinesafraoui 2 ай бұрын
We used sequelize in a school project and omg, oh my god how crappy the DX was I wish we used drizzle instead
@crazycode2578
@crazycode2578 2 ай бұрын
I prefer Prisma than this
@RegalWK
@RegalWK 2 ай бұрын
Also drizzle do not support revert migration, you need to generate another migration with prev state
@RegalWK
@RegalWK 2 ай бұрын
What do you think about drizzle-kit and dangerous cli method push that can destroy a database?
@WebDevCody
@WebDevCody 2 ай бұрын
Don’t use push on production. Use migration scripts like we’ve done for years now
@RegalWK
@RegalWK 2 ай бұрын
@@WebDevCody of course I do that all the time, I'm just point out there is such a possibility
@WebDevCody
@WebDevCody 2 ай бұрын
@@RegalWK ah ok cool
@nikhilpsathyanathan
@nikhilpsathyanathan 2 ай бұрын
How do I migrate without losing data? Can you create a video?
The most important function to write performant next.js apps
5:36
Web Dev Cody
Рет қаралды 17 М.
Drizzle vs Prisma: Which ORM is right for YOU?
5:59
Kodaps Academy
Рет қаралды 7 М.
Or is Harriet Quinn good? #cosplay#joker #Harriet Quinn
00:20
佐助与鸣人
Рет қаралды 58 МЛН
大家都拉出了什么#小丑 #shorts
00:35
好人小丑
Рет қаралды 95 МЛН
Worst flight ever
00:55
Adam W
Рет қаралды 10 МЛН
The Joker wanted to stand at the front, but unexpectedly was beaten up by Officer Rabbit
00:12
HTMX Sucks
25:16
Theo - t3․gg
Рет қаралды 123 М.
How I structure my next.js applications
23:19
Web Dev Cody
Рет қаралды 28 М.
Complex Schema Design with Drizzle ORM | Common Patterns
45:55
Reacting to Controversial Opinions of Software Engineers
9:18
Fireship
Рет қаралды 2,1 МЛН
So, you want to be a programmer?
20:43
ForrestKnight
Рет қаралды 314 М.
No, Einstein Didn’t Solve the Biggest Problem in Physics
8:04
Sabine Hossenfelder
Рет қаралды 275 М.
Here's an overview of all my revenue generating side projects
19:38
This is how I brainstorm new feature ideas
14:49
Web Dev Cody
Рет қаралды 3,9 М.
Is Drizzle Really Better Than Prisma?
20:15
Web Dev Simplified
Рет қаралды 80 М.
the most important Next.js features to learn (in 8 minutes)
8:26
Web Dev Cody
Рет қаралды 43 М.
Or is Harriet Quinn good? #cosplay#joker #Harriet Quinn
00:20
佐助与鸣人
Рет қаралды 58 МЛН