Search Shortcut cmd + k | ctrl + k
Search cmd+k ctrl+k
1.0 (stable)
Node.js API

Modules

duckdb

Typedefs

ColumnInfo : object
TypeInfo : object
DuckDbError : object
HTTPError : object

duckdb

Summary: DuckDB is an embeddable SQL OLAP Database Management System

duckdb~Connection

Kind: inner class of duckdb

connection.run(sql, …params, callback) ⇒ void

Run a SQL statement and trigger a callback when done

Kind: instance method of Connection

Param Type
sql  
…params \*
callback  

connection.all(sql, …params, callback) ⇒ void

Run a SQL query and triggers the callback once for all result rows

Kind: instance method of Connection

Param Type
sql  
…params \*
callback  

connection.arrowIPCAll(sql, …params, callback) ⇒ void

Run a SQL query and serialize the result into the Apache Arrow IPC format (requires arrow extension to be loaded)

Kind: instance method of Connection

Param Type
sql  
…params \*
callback  

connection.arrowIPCStream(sql, …params, callback) ⇒

Run a SQL query, returns a IpcResultStreamIterator that allows streaming the result into the Apache Arrow IPC format (requires arrow extension to be loaded)

Kind: instance method of Connection
Returns: Promise

Param Type
sql  
…params \*
callback  

connection.each(sql, …params, callback) ⇒ void

Runs a SQL query and triggers the callback for each result row

Kind: instance method of Connection

Param Type
sql  
…params \*
callback  

connection.stream(sql, …params)

Kind: instance method of Connection

Param Type
sql  
…params \*

connection.register_udf(name, return_type, fun) ⇒ void

Register a User Defined Function

Kind: instance method of Connection
Note: this follows the wasm udfs somewhat but is simpler because we can pass data much more cleanly

Param
name
return_type
fun

connection.prepare(sql, …params, callback) ⇒ Statement

Prepare a SQL query for execution

Kind: instance method of Connection

Param Type
sql  
…params \*
callback  

connection.exec(sql, …params, callback) ⇒ void

Execute a SQL query

Kind: instance method of Connection

Param Type
sql  
…params \*
callback  

connection.register_udf_bulk(name, return_type, callback) ⇒ void

Register a User Defined Function

Kind: instance method of Connection

Param
name
return_type
callback

connection.unregister_udf(name, return_type, callback) ⇒ void

Unregister a User Defined Function

Kind: instance method of Connection

Param
name
return_type
callback

connection.register_buffer(name, array, force, callback) ⇒ void

Register a Buffer to be scanned using the Apache Arrow IPC scanner (requires arrow extension to be loaded)

Kind: instance method of Connection

Param
name
array
force
callback

connection.unregister_buffer(name, callback) ⇒ void

Unregister the Buffer

Kind: instance method of Connection

Param
name
callback

connection.close(callback) ⇒ void

Closes connection

Kind: instance method of Connection

Param
callback

duckdb~Statement

Kind: inner class of duckdb

statement.sql ⇒

Kind: instance property of Statement
Returns: sql contained in statement
Field:

statement.get()

Not implemented

Kind: instance method of Statement

statement.run(sql, …params, callback) ⇒ void

Kind: instance method of Statement

Param Type
sql  
…params \*
callback  

statement.all(sql, …params, callback) ⇒ void

Kind: instance method of Statement

Param Type
sql  
…params \*
callback  

statement.arrowIPCAll(sql, …params, callback) ⇒ void

Kind: instance method of Statement

Param Type
sql  
…params \*
callback  

statement.each(sql, …params, callback) ⇒ void

Kind: instance method of Statement

Param Type
sql  
…params \*
callback  

statement.finalize(sql, …params, callback) ⇒ void

Kind: instance method of Statement

Param Type
sql  
…params \*
callback  

statement.stream(sql, …params)

Kind: instance method of Statement

Param Type
sql  
…params \*

statement.columns() ⇒ Array.<ColumnInfo>

Kind: instance method of Statement
Returns: Array.<ColumnInfo> - - Array of column names and types

duckdb~QueryResult

Kind: inner class of duckdb

queryResult.nextChunk() ⇒

Kind: instance method of QueryResult
Returns: data chunk

queryResult.nextIpcBuffer() ⇒

Function to fetch the next result blob of an Arrow IPC Stream in a zero-copy way. (requires arrow extension to be loaded)

Kind: instance method of QueryResult
Returns: data chunk

queryResult.asyncIterator()

Kind: instance method of QueryResult

duckdb~Database

Main database interface

Kind: inner property of duckdb

Param Description
path path to database file or :memory: for in-memory database
access_mode access mode
config the configuration object
callback callback function

database.close(callback) ⇒ void

Closes database instance

Kind: instance method of Database

Param
callback

database.close_internal(callback) ⇒ void

Internal method. Do not use, call Connection#close instead

Kind: instance method of Database

Param
callback

database.wait(callback) ⇒ void

Triggers callback when all scheduled database tasks have completed.

Kind: instance method of Database

Param
callback

database.serialize(callback) ⇒ void

Currently a no-op. Provided for SQLite compatibility

Kind: instance method of Database

Param
callback

database.parallelize(callback) ⇒ void

Currently a no-op. Provided for SQLite compatibility

Kind: instance method of Database

Param
callback

database.connect(path) ⇒ Connection

Create a new database connection

Kind: instance method of Database

Param Description
path the database to connect to, either a file path, or :memory:

database.interrupt(callback) ⇒ void

Supposedly interrupt queries, but currently does not do anything.

Kind: instance method of Database

Param
callback

database.prepare(sql) ⇒ Statement

Prepare a SQL query for execution

Kind: instance method of Database

Param
sql

database.run(sql, …params, callback) ⇒ void

Convenience method for Connection#run using a built-in default connection

Kind: instance method of Database

Param Type
sql  
…params \*
callback  

database.scanArrowIpc(sql, …params, callback) ⇒ void

Convenience method for Connection#scanArrowIpc using a built-in default connection

Kind: instance method of Database

Param Type
sql  
…params \*
callback  

database.each(sql, …params, callback) ⇒ void

Kind: instance method of Database

Param Type
sql  
…params \*
callback  

database.stream(sql, …params)

Kind: instance method of Database

Param Type
sql  
…params \*

database.all(sql, …params, callback) ⇒ void

Convenience method for Connection#apply using a built-in default connection

Kind: instance method of Database

Param Type
sql  
…params \*
callback  

database.arrowIPCAll(sql, …params, callback) ⇒ void

Convenience method for Connection#arrowIPCAll using a built-in default connection

Kind: instance method of Database

Param Type
sql  
…params \*
callback  

database.arrowIPCStream(sql, …params, callback) ⇒ void

Convenience method for Connection#arrowIPCStream using a built-in default connection

Kind: instance method of Database

Param Type
sql  
…params \*
callback  

database.exec(sql, …params, callback) ⇒ void

Kind: instance method of Database

Param Type
sql  
…params \*
callback  

database.register_udf(name, return_type, fun) ⇒ this

Register a User Defined Function

Convenience method for Connection#register_udf

Kind: instance method of Database

Param
name
return_type
fun

database.register_buffer(name) ⇒ this

Register a buffer containing serialized data to be scanned from DuckDB.

Convenience method for Connection#unregister_buffer

Kind: instance method of Database

Param
name

database.unregister_buffer(name) ⇒ this

Unregister a Buffer

Convenience method for Connection#unregister_buffer

Kind: instance method of Database

Param
name

database.unregister_udf(name) ⇒ this

Unregister a UDF

Convenience method for Connection#unregister_udf

Kind: instance method of Database

Param
name

database.registerReplacementScan(fun) ⇒ this

Register a table replace scan function

Kind: instance method of Database

Param Description
fun Replacement scan function

database.tokenize(text) ⇒ ScriptTokens

Return positions and types of tokens in given text

Kind: instance method of Database

Param
text

database.get()

Not implemented

Kind: instance method of Database

duckdb~TokenType

Types of tokens return by tokenize.

Kind: inner property of duckdb

duckdb~ERROR : number

Check that errno attribute equals this to check for a duckdb error

Kind: inner constant of duckdb

duckdb~OPEN_READONLY : number

Open database in readonly mode

Kind: inner constant of duckdb

duckdb~OPEN_READWRITE : number

Currently ignored

Kind: inner constant of duckdb

duckdb~OPEN_CREATE : number

Currently ignored

Kind: inner constant of duckdb

duckdb~OPEN_FULLMUTEX : number

Currently ignored

Kind: inner constant of duckdb

duckdb~OPEN_SHAREDCACHE : number

Currently ignored

Kind: inner constant of duckdb

duckdb~OPEN_PRIVATECACHE : number

Currently ignored

Kind: inner constant of duckdb

ColumnInfo : object

Kind: global typedef
Properties

Name Type Description
name string Column name
type TypeInfo Column type

TypeInfo : object

Kind: global typedef
Properties

Name Type Description
id string Type ID
[alias] string SQL type alias
sql_type string SQL type name

DuckDbError : object

Kind: global typedef
Properties

Name Type Description
errno number -1 for DuckDB errors
message string Error message
code string 'DUCKDB_NODEJS_ERROR' for DuckDB errors
errorType string DuckDB error type code (eg, HTTP, IO, Catalog)

HTTPError : object

Kind: global typedef
Extends: DuckDbError
Properties

Name Type Description
statusCode number HTTP response status code
reason string HTTP response reason
response string HTTP response body
headers object HTTP headers
About this page

Last modified: 2024-06-18