Загрузка видео...

Не удалось загрузить видео

На главную

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

389,368 просмотров • 9 дней назад •via X (Twitter)

Комментарии: 48

Фото профиля colinhacks
colinhacks9 дней назад

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

Фото профиля Drizzle ORM
Drizzle ORM9 дней назад

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

Фото профиля colinhacks
colinhacks9 дней назад

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
Igal Klebanov9 дней назад

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
colinhacks9 дней назад

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

Фото профиля Kazi Ahmed ⚡
Kazi Ahmed ⚡9 дней назад

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
colinhacks9 дней назад

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 ⚡
Kazi Ahmed ⚡9 дней назад

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
colinhacks9 дней назад

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 ⚡
Kazi Ahmed ⚡9 дней назад

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
Matija Sosic9 дней назад

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
Chris Griffing9 дней назад

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

Фото профиля Francisco Hermida PRO
Francisco Hermida PRO9 дней назад

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

Фото профиля Matsu
Matsu9 дней назад

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

Фото профиля Aditya Deshlahre
Aditya Deshlahre9 дней назад

Wow, it works out of the box nice

Фото профиля Lachy
Lachy9 дней назад

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
colinhacks9 дней назад

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
Lubos @heyapi.dev9 дней назад

I want some of what you’re on

Фото профиля Kizuno18
Kizuno189 дней назад

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
Rajat9 дней назад

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

Фото профиля colinhacks
colinhacks9 дней назад

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
Rajat9 дней назад

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

Фото профиля colinhacks
colinhacks9 дней назад

@atcb that's supported in Motherload!

Фото профиля ucixrn
ucixrn9 дней назад

Looks cool

Фото профиля freddie
freddie9 дней назад

query builders* ORMs are fine

Фото профиля Jaga santagostino
Jaga santagostino9 дней назад

bittersweet to have this after agents 🥲

Фото профиля klitty
klitty9 дней назад

please i cant keep up anymore

Фото профиля Wessel E
Wessel E9 дней назад

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

Фото профиля Rapid
Rapid9 дней назад

ORM in 2026 😅 what

Фото профиля TheOneHong阿康
TheOneHong阿康9 дней назад

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

Фото профиля Europäische Aktion 🇪🇺 🇩🇪
Europäische Aktion 🇪🇺 🇩🇪9 дней назад

Is it compatible with Bun?

Фото профиля diip3sh
diip3sh9 дней назад

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

Фото профиля el jesu 😎
el jesu 😎9 дней назад

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
Stephen9 дней назад

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

Фото профиля Łukasz Jagodziński
Łukasz Jagodziński9 дней назад

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 ★
Hussein Kizz ★9 дней назад

Are we to throw away our ORMs now?

Фото профиля Matija Sosic
Matija Sosic9 дней назад

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

Фото профиля Chud
Chud9 дней назад

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

Фото профиля David Klingenberg
David Klingenberg9 дней назад

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

Фото профиля zlumer.eth
zlumer.eth9 дней назад

amazing! does it use pgtyped or how it compares?

Фото профиля smallshen
smallshen9 дней назад

What about use prql?

Фото профиля Alberto Díaz
Alberto Díaz9 дней назад

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

Фото профиля colinhacks
colinhacks9 дней назад

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
Alberto Díaz9 дней назад

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
colinhacks9 дней назад

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
Alberto Díaz9 дней назад

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
Sacha9 дней назад

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

Фото профиля Jon Åslund
Jon Åslund9 дней назад

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

Похожие видео