Skip to content
DuckDB community extension

quickjs

DuckDB QuickJS Runtime Extension

01 / SETUP

Install and load

Run these commands in a Haybarn SQL session. The extension is available from the community repository.

Haybarn 2.0.0 Β· SQL
INSTALL quickjs FROM community;
LOAD quickjs FROM community;

Try it in a temporary SQL session with quickjs already loaded. Queries run in this tab; examples using files or services need their own setup.

Using upstream DuckDB? Follow the maintainer’s installation instructions.

02 / QUERY

Usage example

Quack JS with QuickJS

SQL session and output
-- Quack JS with QuickJS
-- Scalar
D SELECT quickjs('2+2');
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ quickjs('2+2') β”‚
β”‚    varchar     β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ 4              β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

-- Scalar Eval
D SELECT quickjs_eval('(a, b) => a + b', 5, 3);
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ quickjs_eval('(a, b) => a + b', 5, 3) β”‚
β”‚                 json                  β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ 8                                     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

-- Table Eval
D SELECT * FROM quickjs('parsed_arg0.map(x => x * arg1)', '[1, 2, 3, 4, 5]', 3);
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ result β”‚
β”‚  json  β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ 3      β”‚
β”‚ 6      β”‚
β”‚ 9      β”‚
β”‚ 12     β”‚
β”‚ 15     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Provided by quackscience. Not yet verified on Haybarn 2.0.0.

Sample data & setup

Documentation and resources

Project and build details
Repository
quackscience/duckdb-quickjs
License
MIT
Maintainers
lmangani, rustyconover
Written in
C++
Build source
96e0ba687861
Build definition
Community descriptor