78 points · by mgramin · 4y ago · 57 comments
https://hn.algolia.com/?dateRange=all&page=0&prefix=false&qu...
It arranges results of join operations just the way I would design it in some report builder. But this is built-in with only two clicks:-)
So this scaffolds sql queries? That's pretty cool
https://github.com/kyleconroy/sqlc/issues/296
Given the success of packaging other Go and Rust tools into npm, like esbuild, I suspect it’s probably actually not too bad of an idea.
https://docs.sqlc.dev/en/latest/reference/language-support.h...
It also only supports PostgreSQL as a first class option. It’s still maturing. That said, I’m using PostgreSQL + Go in production with no qualms.
User authentication? Hard code my credentials, and SSO for users. I dont want to store user accounts (als gets rid of all this password mail and reset stuff). Storing small amounts of data from users? Pickle it to files. Caching data? Keep it in-memory, retrieve it again when server restarts. Need to keep some data? Pickle it all 10 minutes and on sig-int.
Saving so much time and nerves to not having to handle SQL, relations, foreign keys, docker-compose and all the other things.
SQL is a skill, and not a hard one. Develop it once, and its availability becomes a benefit.
Relations are trivial once you have the skill of SQL.
Foreign keys are entirely optional sanity checks. Ignore them.
SQLite comes built in to all your favorite languages, and no need for docker-compose.
And all the other things, like letting the database protect you from race conditions, recovering from crashes and the like, are good.
SQL as a query language is truly horrible once you get past simple data queries. Most people never question if SQL is even good for its job, or if there is an alternative to the SQL, and blindly work on their SQL skills. It's still better than working on the "MongoDB skills", though. But in 2022 the DB interfaces exploration space is expanding, and there are some good alternatives to SQL to learn too.
Oh, really?
I've personally written SQL queries for complex purposes of lengths up to around 1000 lines. I've also had to take what had been SQL queries and rewrite them in a variety of other ways outside of SQL. And vice versa.
SQL feels horribly verbose, right until you compare it with equivalent procedural code. I'm confident in my ability to match or beat the SQL optimizer, I know that doing so will take me significant extra work. And I've seen enough code to know that most developers are unable to do so.
The only tools that I've seen that come close to SQL are themselves thin wrappers around SQL. And I've yet to see them not lose some important capability that SQL has. For example analytic queries (aka window functions) are not often available in other tools.
Just remember to stay in your lane.
What are your favorite three?
Give me a database that has all those other things except SQL.
Also foreign keys are a mixed bag. See https://stackoverflow.com/a/83393/585411 for some of the pluses and minuses. I've seen very experienced people in significant projects go both was on the value of foreign keys. And a lot of the complications are more of a barrier for people who are just learning.
I've personally been on both sides of this fence.
Its liberating to be able to focus only on the code. I am a big fan of KISS. Serverless, or better no-server?, is this pushed to the extreme.
That said, criticizing all Python developers with this brush was very unfair.