Designing a query language where clauses read in execution order — what trade-offs have you hit? #211197
Replies: 2 comments
|
Nice project. A few thoughts from someone who writes a lot of SQL and Python against DuckDB. You are in good company, and it is worth saying so in the README. "Stages in execution order" is exactly what PRQL does (it also compiles to SQL, DuckDB dialect included), what KQL does in Azure Data Explorer ( Discoverability vs familiarity. Pipeline order wins in two places. First, teaching: it matches SQL's logical evaluation order (FROM, WHERE, GROUP BY, HAVING, SELECT, ORDER BY, LIMIT), which is the thing beginners trip over. Second, tooling: once A concrete grammar suggestion: you may not need What I would add next, in this order:
What makes me try a new query language instead of a SQL generator I already have:
I would hold off on anything that does not compile to a plain SQL string, because that is what keeps the language a thin layer rather than a new database. |
|
Hi @absterjr, Interesting project, and the earlier reply covers the landscape (PRQL, KQL, pipe syntax) and roadmap well, so I'll focus on semantic details that tend to bite pipeline languages once real users arrive. 1. Is it easier to learn than SQL? For reading, mostly yes: each line is one transformation and you can mentally "run" the pipeline top to bottom. For beginners the bigger win is that the order you write is the order the data flows. The cost is that anything that feels familiar from SQL but behaves differently becomes a trap, so the docs should call out the differences explicitly (for example, where a 2. Details worth deciding early
3. Testing the compiler Because the target is DuckDB, you can do differential testing: for every example, run the generated SQL and a hand-written equivalent over the same small tables and compare results. That catches semantic drift faster than snapshot-testing SQL strings. 4. What makes a new language worth trying (a user's view) Predictable generated SQL, error messages at the source line/column, and being able to see the SQL and copy it out. Beyond that, a clear explanation of what you can express more easily than in SQL. One or two realistic examples, such as a multi-step analytics query, would convince people faster than the grammar. Hope this is useful, and good luck with the project! |
Uh oh!
There was an error while loading. Please reload this page.
🏷️ Discussion Type
Question
Body
I'm building UNSeQueL, a query language where a program is a pipeline of stages in the order they execute: from, filter, join, group by + aggregate, having, sort, take. It compiles to DuckDB SQL. The motivation is that SQL's keyword order (SELECT before FROM, HAVING after GROUP BY) doesn't match how you reason about a query.
I'd like the community's perspective on the design trade-offs:
Background and grammar: https://github.com/absterjr/UNSeQueL (docs at https://absterjr.github.io/UNSeQueL/).
Guidelines
All reactions