News for hackers. Stuff that matters.
Re:SQLite Is a Library of Congress Recommended Storage Format by LoganDark on Thursday May 07, 2026 @10:02AM (#48049603)
I've always been irked by how SQLite relies on text parsing to work. Why is it that I have to write queries in text rather than expressing them in programmatic logic? I have never used a relational database because of this, because I hate them, but they can be more performant than pure structured data, but I hate SQL and the entire idea of SQL and I don't want to write it or learn it or use a system that relies on it. It feels like the wrong approach, on the level of PHP. Is there anything I can do to help this? I don't want to keep passing up SQLite just because of SQL, but I just can't seem to agree with it. I don't want to build strings or have string parsing anywhere in the stack, it just feels wrong.
Re:SQLite Is a Library of Congress Recommended Storage Format by StilesCrisis on Thursday May 07, 2026 @11:23AM (#48050541)
A "prepared statement" is a precompiled SQL command, ready for bindings and execution: https://sqlite.org/c3ref/stmt.html

You can't precompile your SQL at build time, unfortunately, but you _can_ precompile all your SQL at the very start of your program and then never touch the parser again. This might be a good middle ground for you. It is infra that you can centralize, write some unit tests against, and then not worry about forever.

It's not common because the SQLite parser is lightning fast and it's so convenient to just write out a new query as you need one, versus having one bucket of all queries. But it's an option!

Re:SQLite Is a Library of Congress Recommended Storage Format by weird-eye-issue on Thursday May 07, 2026 @10:52AM (#48050183)
I bet you really love LLMs
Re:SQLite Is a Library of Congress Recommended Storage Format by LoganDark on Thursday May 07, 2026 @11:35AM (#48050693)
I'm torn on LLMs. I've started to use them to accelerate personal development, but they still require a lot of babying and manual assistance. Still, they help a lot.
Re:SQLite Is a Library of Congress Recommended Storage Format by DowsingSpoon on Thursday May 07, 2026 @01:19PM (#48052052)
If you want to avoid string manipulation then you can construct queries with a query builder API like C#'s LINQ. Other languages have similar libraries, e.g., Rust has Diesel.

If your objection is to the SQL language itself then you might find Datalog interesting. Datalog is a logic-based language where you query by writing predicates rather than writing SQL statements. Check out Logica <https://logica.dev>. It's a language in the Datalog family that compiles to SQL.

In both cases, SQL is used only as a low-level IR for interfacing with the database engine.

Re:SQLite Is a Library of Congress Recommended Storage Format by 1718627440 on Friday May 08, 2026 @10:03AM (#48063340)
> Why is it that I have to write queries in text rather than expressing them in programmatic logic?

Do you only use graphical programming languages or how is your "programmatic logic" typically expressed?