Live data from Hacker News

Show HN: Open-source, browser-local data exploration using DuckDB-WASM and PRQL

github.com

1–10 of 84 posts

Show HN: Open-source, browser-local data exploration using DuckDB-WASM and PRQL

#1
Hey HN! We’ve built Pretzel, an open-source data exploration and visualization tool that runs fully in the browser and can handle large files (200 MB CSV on my 8gb MacBook air is snappy). It’s also reactive - so if, for example, you change a filter, all the data transform blocks after it re-evaluate automatically. You can try it here: https://pretzelai.github.io/ (static hosted webpage) or see a demo video here: https://www.youtube.com/watch?v=73wNEun_L7w

You can play with the demo CSV that’s pre-loaded (GitHub data of text-editor adjacent projects) or upload your own CSV/XLSX file. The tool runs fully in-browser—you can disconnect from the internet once the website loads—so feel free to use sensitive data if you like.

Here’s how it works: You upload a CSV file and then, explore your data as a series of successive data transforms and plots. For example, you might: (1) Remove some columns; (2) Apply some filters (remove nulls, remove outliers, restrict time range etc); (3) Do a pivot (i.e, a group-by but fancier); (4) Plot a chart; (5) Download the chart and the the transformed data. See screenshot: https://imgur.com/a/qO4yURI

In the UI, each transform step appears as a “Block”. You can always see the result of the full transform in a table on the right. The transform blocks are editable - for instance in the example above, you can go to step 2, change some filters and the reactivity will take care of re-computing all the cells that follow, including the charts.

We wanted Pretzel to run locally in the browser and be extremely performant on large files. So, we parse CSVs with the fastest CSV parser (uDSV: https://github.com/leeoniya/uDSV) and use DuckDB-Wasm (https://github.com/duckdb/duckdb-wasm) to do all the heavy lifting of processing the data. We also wanted to allow for chained data transformations where each new block operates on the result of the previous block. For this, we’re using PRQL (https://prql-lang.org/) since it maps 1-1 with chained data transform blocks - each block maps to a chunk of PRQL which when combined, describes the full data transform chain. (PRQL doesn’t support DuckDB’s Pivot statement though so we had to make some CTE based hacks).

There’s also an AI block: This is the only (optional) feature that requires an internet connection but we’re working on adding local model support via Ollama. For now, you can use your own OpenAI API key or use an AI server we provide (GPT4 proxy; it’s loaded with a few credits), specify a transform in plain english and get back the SQL for the transform which you can edit.

Our roadmap includes allowing API calls to create new columns; support for an SQL block with nice autocomplete features, and a Python block (using Pyodide to run Python in the browser) on the results of the data transforms, much like a jupyter notebook.

There’s two of us and we’ve only spent about a week coding this and fixing major bugs so there are still some bugs to iron out. We’d love for you to try this and to get your feedback!

Show HN: Open-source, browser-local data exploration using DuckDB-WASM and PRQL
github.com

Re: Show HN: Open-source, browser-local data exploration using DuckDB-WASM and PRQL

#2
That looks great, I love all these new use cases for WASM that are starting to pop up.

Are you planning on supporting parquet files any time soon? I'd love an easy way to just drop a parquet file on there and easily visualize time-series data with it (e.g. sensor readings).

Small issue I noticed: When you chart time-series data, the timestamp axis is just represented as an integer rather than a meaningfully formatted timestamp.

Re: Show HN: Open-source, browser-local data exploration using DuckDB-WASM and PRQL

#3
Oh man this is cool. I don't really have much feedback tbh I just think this awesome. I can see myself using this as a handy little utility when data sets get a bit too big for Google Sheets.

In terms of it being a product, things I can think of that would be useful to me.

- Importing/exporting data from Google Sheets/Google Drive.

- Scheduling queries to run and export etc.

Not sure if that really aligns to this specific project being that it runs locally though.

Edit: Having a few standard dimension tables available to join would be great too. I often want to join time from a date dimension table when I'm making time series data for example.

Re: Show HN: Open-source, browser-local data exploration using DuckDB-WASM and PRQL

#5
post #4

Very cool. Would love to be able to save/share my work (could probably even be in the url string if the CSV were online).

Ramon from Pretzel here, thank you for your feedback! We definitely have this on the roadmap:

1. Allow to download/upload workflows as files (maybe JSON, or PRQL)

2. Allow to share private URLs by attaching the workflow as a URL parameter

We are building a roadmap upvoting site, we'll add it to the README as soon as it's ready

Re: Show HN: Open-source, browser-local data exploration using DuckDB-WASM and PRQL

#6

Oh man this is cool. I don't really have much feedback tbh I just think this awesome. I can see myself using this as a handy little utility when data sets get a bit too big for Google Sheets. In terms of it being a product, things I can think of that would be useful to me. - Importing/exporting data from Google Sheets/Google Drive. - Scheduling queries to run and export etc. Not sure if that really aligns to this spe…

That's great feedback, thanks!

This tool definitely comes from a place of personal need - beyond just handling large files, I've also never really gelled well with the Excel/Google Sheet model of changing data in place as if you were editing text. I'm a Data Scientist and always preferred the chained data transforms you see in things like dplyr (https://dplyr.tidyverse.org/) or Polars (https://pola.rs/) and I feel this tool maps very closely to the chained model.

Also, thank you for the feature requests! Those would all be very useful - we'll put them on the roadmap.

Re: Show HN: Open-source, browser-local data exploration using DuckDB-WASM and PRQL

#7
I was recently searching for something like this - the ability to write PRQL queries on mobile is my ideal usecase. As you note, PRQL is perfect for putting together queries with drop-downs, so I'm a huge fan of the UI that you've put together. Feature request: Exposing the PRQL would be great, and using tabs to switch between the query and results would make it possible to work on mobile. Lastly, bookmarking those queries for later use would be great too!

Re: Show HN: Open-source, browser-local data exploration using DuckDB-WASM and PRQL

#8
post #2

That looks great, I love all these new use cases for WASM that are starting to pop up. Are you planning on supporting parquet files any time soon? I'd love an easy way to just drop a parquet file on there and easily visualize time-series data with it (e.g. sensor readings). Small issue I noticed: When you chart time-series data, the timestamp axis is just represented as an integer rather than a meaningfully formatted…

Thanks for the feedback!

> Are you planning on supporting parquet files any time soon?

Yes. This is an oversight on our part - duckdb natively supports Parquet and Arrow files but we just haven't gotten around to adding upload support for those yet. It's a small change - landing in main tomorrow!

On the bug, yes, we've been trying to parse timestamps but it's just been very finicky. I'll try to fix this! Thanks for the report.

Re: Show HN: Open-source, browser-local data exploration using DuckDB-WASM and PRQL

#9

I was recently searching for something like this - the ability to write PRQL queries on mobile is my ideal usecase. As you note, PRQL is perfect for putting together queries with drop-downs, so I'm a huge fan of the UI that you've put together. Feature request: Exposing the PRQL would be great, and using tabs to switch between the query and results would make it possible to work on mobile. Lastly, bookmarking those q…

Yes! I'm heartened to see people realize the the benefits of PRQL and chained transforms over vanilla SQL (with some caveats!).

We'll definitely add a PRQL/SQL block to the UI soon (you will be able to toggle to select which one you'd like).

On that point - PRQL doesn't natively support PIVOT statements. As a hack, we made our own flavor of PRQL with a PIVOT statement and we parse that to SQL CTEs to make it work for now. I will be submitting a pull request to PRQL to add support to get around this.

We're working on saving queries to local storage as well as sharing via downloadable config files (we're thinking a PRQL file with some sugar that when uploaded, recreates the entire transform)

Post reply on HN