Earlier quoted context omitted.
Jet was built for joins though- sqlc doesn’t seem able to do those.
It can do joins. By default it combines the query into a single flatten struct but you have the option to write the query to embed entities in the join. Not perfect and doesn't maintain the same type if you want a subset of columns but works for the majority of cases.
Sqlc: Compile SQL to type-safe code
71–80 of 109 posts
Re: Sqlc: Compile SQL to type-safe code
#72Re: Sqlc: Compile SQL to type-safe code
#73Earlier quoted context omitted.
I had a look. It says it's type safe but I see strings everywhere. It seems the IDE can autocomplete the strings, but does that count as type safety nowadays? (How does the IDE do the autocomplete on strings? Will the compiler also catch "bad strings"?) Otherwise it looks much like jOOQ but without the "jOOQ generator" (which adds most of the type safety).
TypeScript has literal types: https://www.typescriptlang.org/docs/handbook/2/everyday-type...
I expect those `"a" | "b" | "c"` to be expressed as an enum, not strings and |s.
Re: Sqlc: Compile SQL to type-safe code
#74Earlier quoted context omitted.
I keep hearing about how powerful pg is. It would be great to see an example application that uses all it's features.
Possibly close enough: https://github.com/omnigres/omnigres
Lmao. At least they provide a "slim" flavor without it.
Re: Sqlc: Compile SQL to type-safe code
#75SQLC is good for basic staff, which you should be able to achieve with any ORM. For anything more complicated it fails miserably.
Re: Sqlc: Compile SQL to type-safe code
#76Earlier quoted context omitted.
Possibly close enough: https://github.com/omnigres/omnigres
> Unfortunately, plrust extension is responsible for many gigabytes of artifacts in the image. Typically, if you need Rust, this is not a big problem as both development machines and servers can handle this just fine. Lmao. At least they provide a "slim" flavor without it.
Re: Sqlc: Compile SQL to type-safe code
#77There was a saying that before learning postgres in depth, the db is just a dumb store of data for devs, once you spend time to learn the tools it provides though, most applications just look like a very thin layer on top of the sql. There is so much more to rdbms (especially pg) than just joins - common table expressions, window functions, various views, let alone all the extensibility - extensions, custom types, ev…
Many devs however would consider creating functions and stored procedures a bridge too far to cross.
Re: Sqlc: Compile SQL to type-safe code
#78I've been looking into sqlc lately for Go. Seems brilliant except for the lack of dynamic queries: https://github.com/sqlc-dev/sqlc/discussions/364
You want Jet [0], as mentioned in another comment. I did an extensive survey of golang SQL interfacing libraries before settling on Jet for our team. It's certainly not without warts, but it's got the correct type of API (query builder that maps directly to SQL) and the struct mapping is pretty flexible. sqlc lacking support for dynamic query generation is just absolutely baffling. Composition of query fragments is,…
I can't get behind something like sqlc because if it doesn't support your language or SQL dialect or the feature you need you're worse off than not using it.
Re: Sqlc: Compile SQL to type-safe code
#79I don't work with Go, but this seems like a dream. I really like the SQLx query macros in Rust. I would love for something like this
I'm also using SQLx but I don't see what this adds compared to SQLx. We don't need to generate code and we get the same type safety from queries written in plain SQL. If anything, I wish there was a SQLx in other languages I have to support.
Re: Sqlc: Compile SQL to type-safe code
#80There was a saying that before learning postgres in depth, the db is just a dumb store of data for devs, once you spend time to learn the tools it provides though, most applications just look like a very thin layer on top of the sql. There is so much more to rdbms (especially pg) than just joins - common table expressions, window functions, various views, let alone all the extensibility - extensions, custom types, ev…
I keep hearing about how powerful pg is. It would be great to see an example application that uses all it's features.
quite a lot of ideas what you can do with it.