Search Shortcut cmd + k | ctrl + k
quickjs

DuckDB QuickJS Runtime Extension

Maintainer(s): lmangani

Installing and Loading

INSTALL quickjs FROM community;
LOAD quickjs;

Example

-- 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     
└────────┘

About quickjs

QuickJS DuckDB Extension

This extension provides an embedded QuickJS-NG engine for DuckDB. It allows executing JavaScript code directly within your SQL queries.

QuickJS-NG is a small, fast, and embeddable JavaScript engine that supports modern JavaScript features including ES2020.

This extension is experimental and potentially unstable. Do not use it in production.

Added Functions

function_name function_type description comment examples
quickjs scalar NULL NULL  
quickjs table NULL NULL  
quickjs_eval scalar NULL NULL