Skip to main content

@terascope/data-mate / teal-frame/extensions

teal-frame/extensions

Interfaces​

InterfaceDescription
DuckExtensionThe DuckDB extensions a frame needs, and how the database loads them.
ExtensionSettings-

Variables​

AUTOINSTALL_EXTENSIONS_ENV​

const AUTOINSTALL_EXTENSIONS_ENV: "DUCKDB_AUTOINSTALL_EXTENSIONS" = 'DUCKDB_AUTOINSTALL_EXTENSIONS'

Defined in: data-mate/src/teal-frame/extensions.ts:66

Set to false in an image, so a missing extension fails at startup instead of downloading.


EXTENSION_DIRECTORY_ENV​

const EXTENSION_DIRECTORY_ENV: "DUCKDB_EXTENSION_DIRECTORY" = 'DUCKDB_EXTENSION_DIRECTORY'

Defined in: data-mate/src/teal-frame/extensions.ts:63

Where the extensions live. Unset means DuckDB's default, ~/.duckdb/extensions.


REQUIRED_EXTENSIONS​

const REQUIRED_EXTENSIONS: readonly DuckExtension[]

Defined in: data-mate/src/teal-frame/extensions.ts:26


STATIC_EXTENSIONS​

const STATIC_EXTENSIONS: readonly string[]

Defined in: data-mate/src/teal-frame/extensions.ts:60

Extensions compiled into the binding, which must never be installed: INSTALL parquet downloads a copy that shadows the built-in one and makes duckdb_extensions() misreport it. install checks they are still compiled in, so a DuckDB upgrade that drops one fails the build.

Functions​

extensionSettingsFromEnv()​

extensionSettingsFromEnv(env?): ExtensionSettings

Defined in: data-mate/src/teal-frame/extensions.ts:80

Reads the extension settings from the environment.

They are read from the environment, not only from configureDuckDatabase, because the database may be opened by a frame before any configuration runs, and the directory must be correct from the moment it opens.

Parameters​

ParameterTypeDefault value
envProcessEnvprocess.env

Returns​

ExtensionSettings


firstLine()​

firstLine(err): string

Defined in: data-mate/src/teal-frame/extensions.ts:154

Parameters​

ParameterType
errunknown

Returns​

string


loadExtensions()​

loadExtensions(connection, autoinstall): Promise<void>

Defined in: data-mate/src/teal-frame/extensions.ts:109

Loads every required extension and throws one error naming all that are missing.

With autoinstall on (the default, used in local development) a missing extension is installed first, once per machine. With it off (in an image) nothing uses the network. Loading an already-loaded extension is cheap, so calling this again is harmless.

Parameters​

ParameterType
connectionDuckDBConnection
autoinstallboolean

Returns​

Promise<void>