Live data from Hacker News

Instant SQL for results as you type in DuckDB UI

motherduck.com

71–80 of 124 posts

Re: Instant SQL for results as you type in DuckDB UI

#71

Please finally add q language with proper integration to your tables so that our precious q-SQL is available there. Stop reinventing the wheel, let's at least catch up to the previous generation (in terms of convenience). Make the final step.

Maybe they're busy so it might be faster if you do it instead.

Re: Instant SQL for results as you type in DuckDB UI

#72
post #70

It would be even better if SQL had pipe syntax. SQL is amazing, but its ordering isn’t intuitive, and only CTEs provide a reliable way to preview intermediate results. With pipes, each step could clearly show intermediate outputs. Example: FROM orders |> WHERE order_date >= '2024-01-01' |> AGGREGATE SUM(order_amount) AS total_spent GROUP BY customer_id |> WHERE total_spent > 1000 |> INNER JOIN customers USING(custome…

The PRQL[1] syntax is built around pipelines and works pretty well. I added a similar "get results as you type" feature to the SQLite integration in the Logfile Navigator (lnav)[2]. When entering PRQL queries, the preview will show the results for the current and previous stages of the pipeline. When you move the cursor around, the previews update accordingly. I was waiting years for something like PRQL to implement…

there's a PRQL extension for duckdb:

https://community-extensions.duckdb.org/extensions/prql.html

Re: Instant SQL for results as you type in DuckDB UI

#73
post #2

In DuckDB UI and MotherDuck. Awesome video of feature: https://youtu.be/aFDUlyeMBc8 Disclaimer: I’m a co-founder at MotherDuck.

Curious if there has been any thought given to open sourcing the UI? Of course there's no obligation to though!

We do have plans. It's a question of effort, not business / philosophy.

Re: Instant SQL for results as you type in DuckDB UI

#74
Amazing work. Motherduck and the duckdb ecosystem have done a great job of gathering talented engineers with great taste. Craftsmanship may be the word I’m looking for - I always look forward to their releases.

I spent the first two quarters of 2024 working on observability for a build-the-plane-as-you-fly-it style project. I can’t express how useful the cte preview would have been for debugging.

Re: Instant SQL for results as you type in DuckDB UI

#76
post #21
post #4

I hope this doesn't work with DELETE queries.

for clarity: Instant SQL won't automatically run queries that write or delete data or metadata. It only runs queries that read data.

And this is a happy coincidence that json_serialize_sql doesn't work with anything but select queries

Re: Instant SQL for results as you type in DuckDB UI

#77
post #57

Earlier quoted context omitted.

Google SQL has it now: https://cloud.google.com/blog/products/data-analytics/simpli... It's pretty neat: FROM mydataset.Produce |> WHERE sales > 0 |> AGGREGATE SUM(sales) AS total_sales, COUNT(\*) AS num_sales GROUP BY item; Edit: formatting

note that DuckDB allows that reverse ordering (FROM-first) FROM table SELECT foo, bar WHERE zoo=“goo”

it makes intellisense/autocomplete work a hell of a lot easier. LINQ in dotnet does the same thing.

Re: Instant SQL for results as you type in DuckDB UI

#78
DuckDb is missing a killer feature by not having a pipe syntax like kusto or google's pipe query syntax.

Why is it a killer feature? First of all, LLMs complete text from left to right. That alone is a killer feature.

But for us meatboxes with less compute power, pipe syntax allow (much better) code completion.

Pipe syntax is delightful to work with and makes going back to SQL a real bummer moment (please insert meme of Kate Perry kissing the earth here).

Re: Instant SQL for results as you type in DuckDB UI

#79
post #78

DuckDb is missing a killer feature by not having a pipe syntax like kusto or google's pipe query syntax. Why is it a killer feature? First of all, LLMs complete text from left to right. That alone is a killer feature. But for us meatboxes with less compute power, pipe syntax allow (much better) code completion. Pipe syntax is delightful to work with and makes going back to SQL a real bummer moment (please insert meme…

There’s an extension for that https://github.com/ywelsch/duckdb-psql

Re: Instant SQL for results as you type in DuckDB UI

#80
post #41

Earlier quoted context omitted.

Yes it comes from a desire to impose intuition from other contexts onto something instead of building intuition with that thing. SQL is a declarative language. The ordering of the statements was carefully thought through. I will say it's harmless though, the clauses don't have any dependency in terms of meaning so it's fine to just allow them to be reordered in terms of the meaning of the query, but that's true of lo…

No, it comes from wanting to make autocompletion easier and to make variable scoping/method ordering make sense within LINQ. It is an actual improvement in this regard. LINQ popularized it and others followed. It does what it says. Btw: saying that "people try to impose their own comfort" is uncalled for.

In that case you are just objectively incorrect, you can build a far, far more efficient autocomplete in the standard query order. I will guess something like half as many keystrokes to type the same select and from clauses. You are imagining a very niave autocomplete that can only guess columns after it knows the tables, but in reality you can guess most of the columns, including the first one, the tables, and the aliases. Names in dbs are incredibly sparse, and duplicate names don't make autocomplete less effective.

If you are right about why they did it its even dumber than my reason, they are changing a language grammar to let them make a much worse solution to the same problem.

Post reply on HN