Validate Loaded MotherDuck/DuckDB Extensions
validate_extension_load_status.RdChecks whether specified DuckDB or MotherDuck extensions are loaded in the current session and provides a detailed status report.
Arguments
- .con
A valid
DBIconnection (DuckDB / MotherDuck).- extension_names
A character vector of extensions to validate.
- return_type
One of
"msg","ext", or"arg". Determines the type of return value:"msg"prints CLI messages."ext"returns a list withsuccess_ext,fail_ext, andmissing_ext."arg"returns TRUE if all requested extensions are loaded, FALSE otherwise.
Value
Depending on return_type:
"msg": prints CLI messages (invisibleNULL)."ext": list withsuccess_ext,fail_ext, andmissing_ext."arg": logical indicating if all requested extensions are loaded.
Details
The validate_extension_load_status() function validates the current connection, then
checks which of the requested extensions are loaded. It produces a detailed CLI report
showing which extensions are loaded, failed to load, or missing.
Depending on the return_type argument, the function can either print messages, return
a list of extension statuses, or return a logical value indicating whether all requested
extensions are successfully loaded.
Examples
if (FALSE) { # \dontrun{
con <- DBI::dbConnect(duckdb::duckdb())
# Print CLI report
validate_extension_load_status(con, extension_names = c("excel", "arrow"), return_type = "msg")
# Return a list of loaded, failed, and missing extensions
validate_extension_load_status(con, extension_names = c("excel", "arrow"), return_type = "ext")
# Return logical indicating if all requested extensions are loaded
validate_extension_load_status(con, extension_names = c("excel", "arrow"), return_type = "arg")
} # }