Unpivot Operations with DuckDBClient

Are UNPIVOT operations supported using the DuckDBClient? In this notebook I’m unable to perform an UNPIVOT operation (though perhaps I have a syntax error).

I’m able to run the same operations when directly using duckdb via my terminal (and in other instances have used UNPIVOT with DuckDB-wasm on the web).

Unfortunately we are still stuck with an old version of DuckDB wasm in the notebooks, see Update duckdb-wasm to latest · Issue #588 · observablehq/feedback · GitHub

UNPIVOT works well in Framework if that is any consolation.

Thanks for letting me know, @Fil ! Thought I was losing my mind there for a second.

@Fil Is there a way to load a newer version of DuckDB wasm directly into a notebook for use in a JavaScript cell (I understand that it wouldn’t be used by the SQL cell, but I could then use it directly in JS…)?

Tried it here, getting a pretty unexpected error.

Was getting this error, but it worked with CSV!

.

Well, it worked ONCE with .csv, then on page reload surfaced an error:

Ok, got it to work by loading the data first, then passing the loaded data into the client. Thanks!

https://observablehq.com/@mkfreeman/duckdb-client-unpivot-error#client3

1 Like