Readit News logoReadit News
hamilton commented on Instant SQL for results as you type in DuckDB UI   motherduck.com/blog/intro... · Posted by u/ryguyrg
theLiminator · 10 months ago
Curious if there has been any thought given to open sourcing the UI? Of course there's no obligation to though!
hamilton · 10 months ago
We do have plans. It's a question of effort, not business / philosophy.
hamilton commented on Instant SQL for results as you type in DuckDB UI   motherduck.com/blog/intro... · Posted by u/ryguyrg
RobinL · 10 months ago
Can you go the other way? (E.g. edit the above and turn it back into SQL string)

I've used sqlglot to do this in the past, but doing it natively would be nice

hamilton · 10 months ago
it can, but it doesn't format. You can even run the ast!
hamilton commented on Instant SQL for results as you type in DuckDB UI   motherduck.com/blog/intro... · Posted by u/ryguyrg
jakozaur · 10 months ago
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(customer_id) |> CALL ENRICH.APOLLO(EMAIL > customers.email) |> AGGREGATE COUNT(*) high_value_customer GROUP BY company.country

hamilton · 10 months ago
Obviously one advantage of SQL is everyone knows it. But conceptually, I agree. I think [1]Malloy is also doing some really fantastic work in this area.

This is one of the reasons I'm excited about DuckDB's upcoming [2]PEG parser. If they can pull it off, we could have alternative dialects that run on DuckDB.

[1] https://www.malloydata.dev/ [2] https://duckdb.org/2024/11/22/runtime-extensible-parsers.htm...

hamilton commented on Instant SQL for results as you type in DuckDB UI   motherduck.com/blog/intro... · Posted by u/ryguyrg
jpambrun · 10 months ago
I really like duckdb's notebooks for exploration and this feature makes them even more awesome, but the fact that I can't share, export or commit them into a git repo feels extremely limiting. It's neat-ish that it dodfoods and store them in a duckdb database. It even seems to stores historical versions, but I can't really do anything with it..
hamilton · 10 months ago
Definitely something we want too! (I'm the author / lead for the UI)
hamilton commented on Instant SQL for results as you type in DuckDB UI   motherduck.com/blog/intro... · Posted by u/ryguyrg
pixl97 · 10 months ago
It's probably different for duckdb, but from something like Microsoft SQL tossing off these random queries at a database of any size could have some weird performance impacts. For example statistics on columns you don't want them on, unindexed queries with slow performance, temp tables being dumped out to disk, etc.
hamilton · 10 months ago
I agree; one thing that is neat about Instant SQL is for many reasons, you can't do this with in any other DBMS. You really need DuckDB's specific architecture and ergonomics.
hamilton commented on Instant SQL for results as you type in DuckDB UI   motherduck.com/blog/intro... · Posted by u/ryguyrg
rancar2 · 10 months ago
Thanks for sharing this update with the world and including it on the local ui too.

Feature request: enable the tuning of when Instant SQL is run and displayed. The erroring out with flashing updates at nearly every keystoke while expanding on a query is distracting for me personally (my brain goes into troubleshooting vs thinking mode). I like the feature (so I will keep it on by default), but I’d like to have a few modes for it depending on my working context (specifically tuning of update frequency at separation characters [space, comma], end of statement [semicolon/newline], and injections [paste/autocomplete]).

hamilton · 10 months ago
Great feedback! Thanks. We agree w/ the red errors. It's not helpful when it feels like your editor is screaming at you.
hamilton commented on Instant SQL for results as you type in DuckDB UI   motherduck.com/blog/intro... · Posted by u/ryguyrg
crazygringo · 10 months ago
Edit: never mind, thanks for the replies! I had missed the part where it showed visualizing subqueries, which is what I wanted but didn't think it did. This looks very helpful indeed!
hamilton · 10 months ago
You should read the post! This is what the feature does.
hamilton commented on Instant SQL for results as you type in DuckDB UI   motherduck.com/blog/intro... · Posted by u/ryguyrg
potatohead24 · 10 months ago
It's neat but the CTE selection bit errors out more often than not & erroneously selects more than the current CTE
hamilton · 10 months ago
Can you say more? Where does it error out? Sounds like a bug; if you could post an example query, I bet we can fix that.
hamilton commented on Instant SQL for results as you type in DuckDB UI   motherduck.com/blog/intro... · Posted by u/ryguyrg
ltbarcly3 · 10 months ago
This is such a bizarre feature.
hamilton · 10 months ago
What about it is bizarre?
hamilton commented on Instant SQL for results as you type in DuckDB UI   motherduck.com/blog/intro... · Posted by u/ryguyrg
ayhanfuat · 10 months ago
CTE inspection is amazing. I spend too much time doing that manually.
hamilton · 10 months ago
Me too (author of the post here). In fact, I was watching a seasoned data engineer at MotherDuck show me how they would attempt to debug a regex in a CTE. As a longtime SQL user, I felt the pain immediately; haven't we all been there before? Instant SQL followed from that.

u/hamilton

KarmaCake day380June 19, 2009
About
design and UI engineering at MotherDuck. Building tools to make it easier to write SQL and explore data. Prev Rill Data, Mozilla
View Original