When path is supplied, executes LOAD '/path/to/ext.duckdb_extension'
directly — no install check or auto-install occurs. When only name is
supplied, returns immediately if the extension is already loaded. Otherwise
it checks whether the extension is installed; if not and
auto_install = TRUE, installs it (prompting first when ask = TRUE and
the session is interactive), then executes LOAD <name>.
Usage
ext_load(
name = NULL,
path = NULL,
conn = conn_default(),
auto_install = TRUE,
ask = rlang::is_interactive(),
cache = ext_cache(),
repo = c("core", "community")
)Arguments
- name
Character scalar. Extension name. When
pathis supplied,nameis inferred from the filename and used only in messages.- path
Optional character scalar. Path to a local
.duckdb_extensionfile. When supplied, the extension is loaded directly from disk, bypassing the install check andext_install().- conn
A DuckDB connection. Defaults to
conn_default().- auto_install
Logical. Install automatically when the extension is missing. Default
TRUE. Ignored whenpathis supplied.- ask
Logical. Prompt the user before installing. Defaults to
rlang::is_interactive(), so it never prompts during tests or in non-interactive sessions. Ignored whenauto_install = FALSEorpathis supplied.- cache
An
ext_cacheobject forwarded toext_install()on auto-install. Ignored whenpathis supplied.- repo
"core"or"community". Forwarded toext_install(). Ignored whenpathis supplied.
Examples
if (FALSE) { # \dontrun{
# Requires network access to download and load the extension.
conn <- DBI::dbConnect(duckdb::duckdb())
ext_load("httpfs", conn = conn)
DBI::dbDisconnect(conn, shutdown = TRUE)
} # }