@sqlrooms/duckdb / BaseDuckDbConnector
Class: BaseDuckDbConnector
Extended by
Implements
Constructors
new BaseDuckDbConnector()
new BaseDuckDbConnector(
__namedParameters
):BaseDuckDbConnector
Parameters
Parameter | Type |
---|---|
__namedParameters | { dbPath : string ; initializationQuery : string ; } |
__namedParameters.dbPath ? | string |
__namedParameters.initializationQuery ? | string |
Returns
Properties
Property | Modifier | Type | Default value |
---|---|---|---|
dbPath | protected | string | undefined |
initializationQuery | protected | string | undefined |
initialized | protected | boolean | false |
initializing | protected | null | Promise <void > | null |
Methods
initialize()
initialize():
Promise
<void
>
Initialize the connector
Returns
Promise
<void
>
Implementation of
initializeInternal()
protected
initializeInternal():Promise
<void
>
Returns
Promise
<void
>
destroy()
destroy():
Promise
<void
>
Destroy the connector and clean up resources
Returns
Promise
<void
>
Implementation of
ensureInitialized()
protected
ensureInitialized():Promise
<void
>
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
>>
Implementation of
loadFile()
loadFile(
file
,tableName
,opts
?):Promise
<void
>
Load a file into DuckDB and create a table
Parameters
Parameter | Type | Description |
---|---|---|
file | string | File | - |
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
>
Implementation of
loadArrow()
loadArrow(
file
,tableName
,opts
?):Promise
<void
>
Load an arrow table or an arrow IPC stream into DuckDB
Parameters
Parameter | Type | Description |
---|---|---|
file | Table <any > | Uint8Array <ArrayBufferLike > | - |
tableName | string | Name of the table to create |
opts ? | { schema : string ; } | - |
opts.schema ? | string | - |
Returns
Promise
<void
>
Implementation of
loadObjects()
loadObjects(
file
,tableName
,opts
?):Promise
<void
>
Load JavaScript objects into DuckDB
Parameters
Parameter | Type | Description |
---|---|---|
file | Record <string , unknown >[] | - |
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
>