Skip to content

Latest commit

 

History

History

duckdb

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

README.md

Connecting JavaScript and DuckDB with ADBC

Instructions

Prerequisites

  1. Install Node.js (version 22 or later)

    • Alternatively, you can use Bun or Deno
  2. Install dbc

  3. Install DuckDB

    • On macOS, if you have Homebrew installed, run brew install duckdb

Connect to DuckDB

  1. Install the DuckDB ADBC driver:

    dbc install duckdb
  2. Install dependencies:

    npm --prefix .. install
  3. Customize the script main.js as needed

    • Change the path in databaseOptions to the location of the DuckDB database file you want to query, or keep it set to games.duckdb to use the database file included with this example
    • If you changed the database file, also change the SQL SELECT statement in conn.query()
  4. Run the script:

    Node.js:

    node main.js

    Bun:

    bun run main.js

    Deno:

    deno run --allow-ffi --allow-env main.js