con <- DBI::dbConnect(duckdb::duckdb(dbdir = tempfile()))
# Print CLI report
validate_extension_install_status(con, extension_names = c("arrow", "excel"), return_type = "msg")
# Return a list of installed and failed extensions
validate_extension_install_status(con, extension_names = c("arrow", "excel"), return_type = "ext")
# Return logical indicating if all requested extensions are installed
validate_extension_install_status(con, extension_names = c("arrow", "excel"), return_type = "arg")Validate Installed MotherDuck/DuckDB Extensions
Source: R/utils-md.R
Checks whether specified DuckDB or MotherDuck extensions are installed and provides a detailed status report.
Usage
validate_extension_install_status(.con, extension_names, return_type = "msg")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 of installed and failed extensions. -
“arg”returns TRUE if all requested extensions are installed, FALSE otherwise.
-
Value
Depending on return_type:
-
“msg”: prints CLI messages (invisibleNULL). -
“ext”: list withsuccess_extandfail_ext. -
“arg”: logical indicating if all requested extensions are installed.
Details
The validate_extension_install_status() function validates the current connection and checks which of the requested extensions are installed. It produces a detailed CLI report showing which extensions are installed, not installed, or missing.
The function can return different outputs based on the return_type argument:
-
“msg”: prints a CLI report with extension statuses. -
“ext”: returns a list containingsuccess_ext(installed) andfail_ext(not installed). -
“arg”: returns a logical value indicating whether all requested extensions are installed.
See Also
Other db-con: install_extensions(), load_extensions(), show_motherduck_token(), validate_extension_load_status()