Observable college degree browsing. #356
Replies: 2 comments 10 replies
-
This is awesome, thanks a lot for sharing! I think you raised an important point. Maybe this justifies thinking of a more reactive caching wrapper for DuckDB-Wasm. const rx = new duckdb.ReactiveTables(db);
const table = rx.createTableAs("foo", (props) => `SELECT ... ${..}`);
const cached = table.query((props) => `SELECT min(x), max(x), count(distinct x) FROM foo`);
// ...
const somefilter = ...;
await table.evaluate(somefilter); // noop if the same
const domain = cached.get(); |
Beta Was this translation helpful? Give feedback.
-
A small note on the parquet files here: The observable examples run into CORS issues very quickly with the attachments. |
Beta Was this translation helpful? Give feedback.
-
Here's a stab at a 2-million-row in-browser database in Observable; data about US degree recipients counted at the school-year-major level. As I say in the notebook, I've looked at this same set (basically) before with raw arrow and arquero functions--I'm seeing a big (5-10x) speedup here, fast enough to make things like interactive maps clickable.
So, great job guys! The performance here here is everything I was hoping for.
On observation in doing this with observable is that the programming flow to and from Javascript is a little awkward--to keep the network topology straight, I end up writing a lot of dummy JS variables that exist solely to mirror internal duckdb tables. E.g. here's a table that needs to update whenever the
all_inst_filters
list changes, and then trigger another query:In svelte I suspect I'll run into some similar issues. I feel like an idiomatic solution will either lead somewhere interesting, or towards somewhere that parts of the vegaverse have already gone.
And doing something like reinserting an observable table back into the database is clunky, as well--I wrote a bunch of
WHERE field_col in ("A", "B", "C", "D", "E")
where in Python I would have just registered an arrow dataframe inside duckdb and done anINNER JOIN
.Beta Was this translation helpful? Give feedback.
All reactions