Live data from Hacker News

Open-sourcing SQX, a way to build flexible database models in Go

stytch.com

21–28 of 28 posts

Re: Open-sourcing SQX, a way to build flexible database models in Go

#21
post #6

This does look like it's a little bit better than a lot of the other options in the Go ecosystem for database access, but this introduction misses something important: what SQL dialects does this support? It appears to be partly a wrapper around Squirrel. Squirrel is not new (and apparently also no longer being updated) but I actually have no idea which and how much of each SQL dialect Squirrel supports. Every time I…

I can atest to this. Sqlc is awesome.

Re: Open-sourcing SQX, a way to build flexible database models in Go

#22
post #11

Earlier quoted context omitted.

Type safe sql is a feature of most every production quality db library I’ve used going back 20 years. You don’t need the complexity of an orm to get that. As for trivial boilerplate, I tend to find that trivial boilerplate no more troubling than any of the other compromises orms require, whether that’s polluting my data model with sql concerns or making me conform to db practices that aren’t correct for my needs. And…

I still find myself having the experience of having to unit test trivialities with direct SQL coding, lest I miss a typo, which is a (very basic) thing any ORM or query wrapper will tend to save me from.

I need to do the same thing with attributes, naming conventions, etc that are typically required to make orms work.

Re: Open-sourcing SQX, a way to build flexible database models in Go

#23
post #20

Earlier quoted context omitted.

It's easy to drop down to pure SQL in every ORM I've ever used. Meanwhile, a good ORM gives you type safe queries, and saves from having to write boilerplate for trivial CRUD. I honestly would like to know which ORMs most critics have experience with. If it's something terrible like Hibernate, then no wonder. For reference, the ORM I've used the most is Entity Framework (the new one, rewritten for NET Core), and it's…

Modern ORMs like Drizzle and Prisma can probably generate more safe and efficient SQL queries than you could write by hand in a fourth of the time and effort

Drizzle is much closer to a classic sql builder than an orm. At least in my case the trouble with ORMs is mostly in the concept itself. Mapping sql results into objects defined as part of a business model.

Just generating sql from native code is not an orm.

Re: Open-sourcing SQX, a way to build flexible database models in Go

#24
post #6

This does look like it's a little bit better than a lot of the other options in the Go ecosystem for database access, but this introduction misses something important: what SQL dialects does this support? It appears to be partly a wrapper around Squirrel. Squirrel is not new (and apparently also no longer being updated) but I actually have no idea which and how much of each SQL dialect Squirrel supports. Every time I…

I used sqlc with sqlite. The support seems fine there.

In general, sqlc is very nice to use. It works well out of the box with a standard config. You can also override a lot of things.

One of the nice extras about sqlc is that it doesn't feel like a real dependency.

You don't actually include sqlc anywhere. You just use a config and the cli to generate Go code that relies on the std library. The generated code is very straight forward std Go code that you could write by hand.

A couple of reasons to use Go in a project would be great support for IO, stability, great tooling, low operational complexity and minimal dependencies. sqlc fits nicely in there.

Post reply on HN