A more elegant SQL-equivalent language/syntax? (“The Markdown of SQL”?)

83 views Asked by At

I thought about writing a simple universal tool for processing lightly structured data (lists separated by markers, TSV, indentation, CSV, maybe simple markup, all text-based) for shell scripting (think awk, but not growing into a programming language).
It quickly became clear that it would end up with an interface similar to the basic SQL commands. And it would be useful for much more general task sets than just the basic goal above.

But SQL is very verbose and inelegant compared to the ease of use I want and people on a shell expect. (Otherwise I’m sure there’s SQL database backends for everything under the sun. :) (And I don’t want a SQL transpiler either, as it should be a small thing that does this one thing (structured text data editing), and does it right. Not drag a whole DBMS or even SQLite into it.)

I found XPath nice for queries. Although that has become quite bloated too, due to its origins. Haskell’s list comprehension syntax also appeals to me. But implementing it seems harder than basic XPath functionality. As I said, I don’t want it to grow into yet another awk. I also vaquely remember certain syntaxes for generating markup out of a simple XPath-like syntax but with dots (like in OOP) instead of slashes. Also, being able to use perform CRUD operations on things selected with this syntax is the point.

So I wonder: Is there a nice, clean, elegant, emergent little language/syntax, that offers just what an SQL SELECT can do, for … lists, tables, trees, and preferably graphs. (The ability to handle tree data structures is what got me into this, so it’s essential.)
Ideally not giving me much trouble implementing it (using a library or doing it myself).

Or maybe, such a tool already exists. (Though I haven’t seen a generic one yet. Only things like awk or jq, etc.)

Since I’m also doing this for educational purposes too, I’d love implementing it myself though. Even if I’d just re-implement an existing tool.

1

There are 1 answers

0
RARE Kpop Manifesto On

isn't jq good enough ? can't be more light weight yet well-featured than that