Skip to content

luke-strange/lume-duck

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lume-duck

DuckDB data in Lume

NOTE You will need to have the appropriate DuckDB C/C++ library installed for your system! This module contains a provisioner which automates extracting to the current directory.

deno run -A jsr:@dringtech/lume-duck/provisioner

Quick start

Add the following lines to your Lume _config.ts file

import { duckDbLoader } from "jsr:@dringtech/lume-duck";

site.loadData([".sql"], duckDbLoader());

Any SQL files in _data directories will be loaded as DuckDB queries. The data file name is a function which executes the contained SQL, i.e. _data/sample.sql would be accessible as sample().

Examples (each assumes in a file called _data/query.sql):

SQL Query Result
SELECT 1 AS number; query() [{number:1}]
SELECT ?::INTEGER AS number; query(2) [{number:2}]
SELECT ?::INTEGER AS number, ?::STRING AS string; query(3, 'x') [{number:3,string:'x'}]
SELECT $2::INTEGER AS number, $1::STRING AS string; query('y', 4) [{number:4,string:'y'}]

About

DuckDB data in Lume

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 100.0%