Video yükleniyor...

Video Yüklenemedi

Ana Sayfaya Dön

type inference from .sql files has been achieved internally ORMs are toast

389,189 görüntüleme • 8 gün önce •via X (Twitter)

48 Yorum

colinhacks profil fotoğrafı
colinhacks8 gün önce

this is still beta but you can play with it here 👉

Drizzle ORM profil fotoğrafı
Drizzle ORM7 gün önce

Wow, nice Is that fundamentally different from what prisma’ve done?

colinhacks profil fotoğrafı
colinhacks7 gün önce

I have a hundred issues with TypedSQL but tl;dr I think content mappers in TS 7.1 change the calculus for something like this 👍

Igal Klebanov profil fotoğrafı
Igal Klebanov7 gün önce

very cool use of the new ts stuff! the ecosystem had these author-raw-get-something-typechecked things for a while now. some with codegen, some through ide extensions - so removing the need for something extra in process or dependencies is dope.

colinhacks profil fotoğrafı
colinhacks7 gün önce

game changer for sure! I'm happy for an excuse to start my next database tooling era ✨

Kazi Ahmed ⚡ profil fotoğrafı
Kazi Ahmed ⚡7 gün önce

Maannnnn how. How can it know the union? That blew me away. I'm sold. I'm all for type safety, so much so that I have made Tanstack Router like back-end API router that knows layout params or auth state with type safety for that layout branch.

colinhacks profil fotoğrafı
colinhacks7 gün önce

a LOT of work went into inference engine. check out the Inference docs here for a bunch of examples, you'll dig it 👇

Kazi Ahmed ⚡ profil fotoğrafı
Kazi Ahmed ⚡7 gün önce

Sorry it suddenly hit me. Does the mappers also work as a module loader or transformer during build or bundle? Inferring types is one thing but wrapping the contents of the SQL file with custom adapter is different. Looks like ts prescribing to use bundlers like vite?

colinhacks profil fotoğrafı
colinhacks7 gün önce

good question, you need to configure Reylo in tsconfig.json and in your bundler/runtime config to have agreement. it's similar to using tsconfig "paths" Reylo is one package containing lots of plugins lol

Kazi Ahmed ⚡ profil fotoğrafı
Kazi Ahmed ⚡7 gün önce

Thanks. That makes perfect sense. I was reading the Reylo codebase and found the plugins. There's a lot of goodies in the codebase.

Matija Sosic profil fotoğrafı
Matija Sosic7 gün önce

I was wondering how/why to use Reylo instead of a "regular" ORM like @prisma or @DrizzleORM, so I put together a quick explainer. TL;DR: - This is possible due to a new mechanism in TS 7.1 - It's a way to get type-safe SQL without codegen - It actually talks to your db, at compile time, to check the types

Chris Griffing profil fotoğrafı
Chris Griffing7 gün önce

Its not about the lack of ORMs at the end, it's about the ORMs we made along the way.

Francisco Hermida PRO profil fotoğrafı
Francisco Hermida PRO7 gün önce

this for sqlfu @mmkalmmkal ? would you still recommend it?

Matsu profil fotoğrafı
Matsu7 gün önce

How does this differ from something like Kysely? By allowing you to import sql files instead of using a tagged template literal?

Aditya Deshlahre profil fotoğrafı
Aditya Deshlahre7 gün önce

Wow, it works out of the box nice

Lachy profil fotoğrafı
Lachy7 gün önce

if types come from the .sql file itself, how does it resolve a column's type for a join across two tables? does it read the live database schema at build time, or a schema file checked into the repo?

colinhacks profil fotoğrafı
colinhacks7 gün önce

good question, Reylo's inference engine sends the query to your database, extracts out the type descriptors from the prepared query, and cross-references against catalog (Postgres) or information_tables (other dialects) so the type information always comes from the database itself 👍

Lubos @heyapi.dev profil fotoğrafı
Lubos @heyapi.dev7 gün önce

I want some of what you’re on

Kizuno18 profil fotoğrafı
Kizuno187 gün önce

skipping the codegen step and having direct compiler inference from raw .sql is huge. how does the parser handle complex jsonb projections or cte unions?

Rajat profil fotoğrafı
Rajat7 gün önce

Damn 🔥 Is it possible to write SQL inside .ts files and get the same type inference?

colinhacks profil fotoğrafı
colinhacks7 gün önce

unfortunately not, I heard @atcb may have some early plans cooking for that but I actually prefer for stuff like this to happen at an import boundary. Reylo is implemented as a content mapper (basically a plugin for TypeScript)

Rajat profil fotoğrafı
Rajat7 gün önce

@atcb can you make a plugin for jsonc too? its been a while since people asking for a support in typescript repo

colinhacks profil fotoğrafı
colinhacks7 gün önce

@atcb that's supported in Motherload!

ucixrn profil fotoğrafı
ucixrn7 gün önce

Looks cool

freddie profil fotoğrafı
freddie7 gün önce

query builders* ORMs are fine

Jaga santagostino profil fotoğrafı
Jaga santagostino7 gün önce

bittersweet to have this after agents 🥲

klitty profil fotoğrafı
klitty7 gün önce

please i cant keep up anymore

Wessel E profil fotoğrafı
Wessel E7 gün önce

Give us six months and we'll put an ORM back on top of those.sql files.

Rapid profil fotoğrafı
Rapid7 gün önce

ORM in 2026 😅 what

TheOneHong阿康 profil fotoğrafı
TheOneHong阿康7 gün önce

if type inference can be done with embedded sql statement, will be goated

Europäische Aktion 🇪🇺 🇩🇪 profil fotoğrafı
Europäische Aktion 🇪🇺 🇩🇪7 gün önce

Is it compatible with Bun?

diip3sh profil fotoğrafı
diip3sh7 gün önce

does the inference track a left join becoming effectively inner when a where clause rules out nulls on the joined table?

el jesu 😎 profil fotoğrafı
el jesu 😎7 gün önce

Hi! question from a humble java Dev watching your video made me realize that you'd add one SQL file for every query wou use is it something standard in typescript/JavaScript backbends? it seems to me that's only appropriate for micro micro services

Stephen profil fotoğrafı
Stephen7 gün önce

This is similar to what SQLC does in Golang...

Łukasz Jagodziński profil fotoğrafı
Łukasz Jagodziński7 gün önce

ORMs are not toasted as you can’t build type safe dynamic queries this way. I built an SQL code generator in the past and it was the biggest issue with that kind of solution. I guess you could have more complex logic in SQL but most people will prefer building their queries with query builders.

Hussein Kizz ★ profil fotoğrafı
Hussein Kizz ★7 gün önce

Are we to throw away our ORMs now?

Matija Sosic profil fotoğrafı
Matija Sosic7 gün önce

Why is this better than using an ORM like Prisma or Drizzle?

Chud profil fotoğrafı
Chud7 gün önce

this is actually crazy, great things coming typescript’s way

David Klingenberg profil fotoğrafı
David Klingenberg7 gün önce

Wow, that's pretty cool. It reminds me Type Providers in F# :)

zlumer.eth profil fotoğrafı
zlumer.eth7 gün önce

amazing! does it use pgtyped or how it compares?

smallshen profil fotoğrafı
smallshen7 gün önce

What about use prql?

Alberto Díaz profil fotoğrafı
Alberto Díaz7 gün önce

What do ORMs provide over this? I guess that some people prefer to write queries using ORMs rather than SQL?

colinhacks profil fotoğrafı
colinhacks7 gün önce

declarative schema & migrations are nice! Reylo doesn't do that (probably never will) but with content mappers enabling direct .sql imports from TypeScript files, I don't really see why anyone would use an ORM over Reylo for actually writing queries

Alberto Díaz profil fotoğrafı
Alberto Díaz7 gün önce

Any chance that we get type inference from inline queries? Or must they be a separate SQL file? I am eager to try Reylo, but I am wondering if I can truly apply it to a project where every query is inline (within TS files)

colinhacks profil fotoğrafı
colinhacks7 gün önce

it's not possible with content mappers. you could probably use Reylo's engine and integrate it into some kind of build step, but I'm pretty allergic to that kind of thing...lots of thorny edge cases when it comes to static analysis like this

Alberto Díaz profil fotoğrafı
Alberto Díaz7 gün önce

Thanks! I would have to extract every single SQL query into a companion SQL file. Tbh, I may give it a try. I was planning to move everything to kysely or drizzle, but... Reylo looks kinda neat :D

Sacha profil fotoğrafı
Sacha7 gün önce

This 97 year old diner still serves their Coke the old-fashioned way.

Jon Åslund profil fotoğrafı
Jon Åslund7 gün önce

Why does it infer return type | null after you add the email where clause?

Benzer Videolar