Skip to content

@sqlrooms/duckdb / load

Function: load()

load(method, tableName, fileName, options, defaults): string

Generic function to load data from a file into a DuckDB table

Parameters

ParameterTypeDescription
method"read_json" | "read_ndjson" | "read_parquet" | "read_csv" | "auto" | "st_read"The DuckDB read method to use (e.g., 'read_csv', 'read_json')
tableNamestringName of the table to create
fileNamestringPath to the input file
optionsobjectOutputTypeLoad options including select, where, view, temp, replace and file-specific options
defaultsRecord<string, unknown>Default options to merge with provided options

Returns

string

SQL query string to create the table