@sqlrooms/duckdb / DuckDbConnector
Interface: DuckDbConnector
Methods
initialize()
initialize():
Promise
<void
>
Initialize the connector
Returns
Promise
<void
>
destroy()
destroy():
Promise
<void
>
Destroy the connector and clean up resources
Returns
Promise
<void
>
query()
query(
query
):Promise
<Table
<any
>>
Execute a SQL query and return the result as an Arrow table
Parameters
Parameter | Type | Description |
---|---|---|
query | string | SQL query to execute |
Returns
Promise
<Table
<any
>>
loadFile()
loadFile(
fileName
,tableName
,opts
?):Promise
<void
>
Load a file into DuckDB and create a table
Parameters
Parameter | Type | Description |
---|---|---|
fileName | string | File | Path to the file to load |
tableName | string | Name of the table to create |
opts ? | objectOutputType <extendShape <{ schema : ZodOptional <ZodString >; select : ZodOptional <ZodArray <ZodString , "many" >>; where : ZodOptional <ZodString >; view : ZodOptional <ZodBoolean >; temp : ZodOptional <ZodBoolean >; replace : ZodOptional <ZodBoolean >; }, { method : ZodEnum <["read_json" , "read_ndjson" , "read_parquet" , "read_csv" , "auto" ]>; }>, ZodUnknown , "strip" > | objectOutputType <extendShape <extendShape <{ schema : ZodOptional <ZodString >; select : ZodOptional <ZodArray <ZodString , "many" >>; where : ZodOptional <ZodString >; view : ZodOptional <ZodBoolean >; temp : ZodOptional <ZodBoolean >; replace : ZodOptional <ZodBoolean >; }, { options : ZodOptional <ZodUnion <[ZodArray <ZodString , "many" >, ZodString , ZodRecord <ZodString , ZodUnknown >]>>; }>, { method : ZodLiteral <"st_read" >; }>, ZodUnknown , "strip" > | Load options |
Returns
Promise
<void
>
loadArrow()
loadArrow(
table
,tableName
,opts
?):Promise
<void
>
Load an arrow table or an arrow IPC stream into DuckDB
Parameters
Parameter | Type | Description |
---|---|---|
table | Table <any > | Uint8Array <ArrayBufferLike > | Arrow table or arrow IPC stream to load |
tableName | string | Name of the table to create |
opts ? | { schema : string ; } | - |
opts.schema ? | string | - |
Returns
Promise
<void
>
loadObjects()
loadObjects(
data
,tableName
,opts
?):Promise
<void
>
Load JavaScript objects into DuckDB
Parameters
Parameter | Type | Description |
---|---|---|
data | Record <string , unknown >[] | Array of objects to load |
tableName | string | Name of the table to create |
opts ? | objectOutputType <{ schema : ZodOptional <ZodString >; select : ZodOptional <ZodArray <ZodString , "many" >>; where : ZodOptional <ZodString >; view : ZodOptional <ZodBoolean >; temp : ZodOptional <ZodBoolean >; replace : ZodOptional <ZodBoolean >; }, ZodUnknown , "strip" > | Load options |
Returns
Promise
<void
>