I love the attitude towards ergonomics over standard compliance. And you'll see why SQL has never been really portable across databases ;-)
Maybe if SQL was a better language at the start, there would be more incentive to follow the spec.
Friendlier SQL with DuckDB
61–70 of 134 posts
Re: Friendlier SQL with DuckDB
#62Lots of great additions. I will just highlight two: Column selection : When you have tons of columns these become useful. Clickhouse takes it to the next level and supports APPLY and COLUMN in addition to EXCEPT, REPLACE which DuckDB supports: - APPLY: apply a function to a set of columns - COLUMN: select columns by matching a regular expression (!) Details here: https://clickhouse.com/docs/en/sql-reference/statement…
Yes, trailing commas should work everywhere! JSON is the other one where it annoys me, but luckily I rarely hand-write any JSON anymore (and there are semi-solutions for this like json5). In code I always add trailing commas to anything comma-separated. It makes editing simpler (you can shuffle lines without thinking about commas). In a diff or blame it doesn't show adding a comma as a change. SQL is the one spot whe…
VSCode uses it for configuration, but when I wanted to use it in Python (to add context to source-controlled Elasticsearch schemas) there were only a couple old barely-maintained libraries for parsing.
Re: Friendlier SQL with DuckDB
#63Lots of great additions. I will just highlight two: Column selection : When you have tons of columns these become useful. Clickhouse takes it to the next level and supports APPLY and COLUMN in addition to EXCEPT, REPLACE which DuckDB supports: - APPLY: apply a function to a set of columns - COLUMN: select columns by matching a regular expression (!) Details here: https://clickhouse.com/docs/en/sql-reference/statement…
Allow referencing columns defined previously in the same query would make duckdb competitive for data analytics. Without that one has to chain With statements for just the tiniest operations. select 1 as x, x + 2 as y, y/x as z;
But I know a user requirement when I hear one, so can you give me an large, real example of where allowing this would make things easier? That would be mega helpful, ta
Re: Friendlier SQL with DuckDB
#64I love the attitude towards ergonomics over standard compliance. And you'll see why SQL has never been really portable across databases ;-)
Maybe if SQL was a better language at the start, there would be more incentive to follow the spec.
(Info from memory, may be wrong or a bit mangled)
Re: Friendlier SQL with DuckDB
#65Earlier quoted context omitted.
Maybe if SQL was a better language at the start, there would be more incentive to follow the spec.
SQL is an amazingly good language for what it does. It has been with us coming up on 5 decades.
Re: Friendlier SQL with DuckDB
#66Re: Friendlier SQL with DuckDB
#67 SELECT age, sum(civility) as total_civility
FROM star_wars_universe
ORDER BY ALL
-- ORDER BY age, total_civility
there's no GROUP BY?edit: (removed edit, I blew it, sorry)
Re: Friendlier SQL with DuckDB
#68If anyone is interested in improvements to SQL, checkout PRQL https://github.com/prql/prql , a pipelined relational query language. It supports: - functions, - using an alias in same `select` that defined it, - trailing commas, - date literals, f-strings and other small improvements we found unpleasant with SQL. https://lang.prql.builders/introduction.html The best part: it compiles into SQL. It's under development,…
My fear with PRQL is that i'd more easily ask too much of the DB, given how easy it looks to write larger and more complex SQL. Thoughts?
Re: Friendlier SQL with DuckDB
#69Lots of great additions. I will just highlight two: Column selection : When you have tons of columns these become useful. Clickhouse takes it to the next level and supports APPLY and COLUMN in addition to EXCEPT, REPLACE which DuckDB supports: - APPLY: apply a function to a set of columns - COLUMN: select columns by matching a regular expression (!) Details here: https://clickhouse.com/docs/en/sql-reference/statement…
>> Allowing for trailing commas should get included in the SQL spec.
So there is no "SQL spec" per se, there's an ANSI specification with decades of convention and provider-specific customizations piled on top. This support for trailing commas is the best you're going to get.
Re: Friendlier SQL with DuckDB
#70Earlier quoted context omitted.
Yes, trailing commas should work everywhere! JSON is the other one where it annoys me, but luckily I rarely hand-write any JSON anymore (and there are semi-solutions for this like json5). In code I always add trailing commas to anything comma-separated. It makes editing simpler (you can shuffle lines without thinking about commas). In a diff or blame it doesn't show adding a comma as a change. SQL is the one spot whe…
JSONC allows comments and trailing commas, but adoption seems to be low. VSCode uses it for configuration, but when I wanted to use it in Python (to add context to source-controlled Elasticsearch schemas) there were only a couple old barely-maintained libraries for parsing.
Do they work, though? If it’s a mostly stable standard, doesn’t seem like you’d need a frequently updated parser.