Skip to content

[Experimental]

Runs a query and returns it as a duckplyr frame.

Usage

read_sql_duckdb(
  sql,
  ...,
  prudence = c("thrifty", "lavish", "stingy"),
  con = NULL
)

Arguments

sql

The SQL to run.

...

These dots are for future extensions and must be empty.

prudence

Memory protection, controls if DuckDB may convert intermediate results in DuckDB-managed memory to data frames in R memory.

  • "thrifty": up to a maximum size of 1 million cells,

  • "lavish": regardless of size,

  • "stingy": never.

The default is "thrifty" for the ingestion functions, and may be different for other functions. See vignette("prudence") for more information.

con

The connection, defaults to the default connection.

Details

Using data frames from the calling environment is not supported yet, see https://github.com/duckdb/duckdb-r/issues/645 for details.

See also

Examples

read_sql_duckdb("FROM duckdb_settings()")
#> # A duckplyr data frame: 5 variables
#>    name                            value     description  input_type scope
#>    <chr>                           <chr>     <chr>        <chr>      <chr>
#>  1 access_mode                     automatic "Access mod… VARCHAR    GLOB…
#>  2 allow_persistent_secrets        true      "Allow the … BOOLEAN    GLOB…
#>  3 catalog_error_max_schemas       100       "The maximu… UBIGINT    GLOB…
#>  4 checkpoint_threshold            16.0 MiB  "The WAL si… VARCHAR    GLOB…
#>  5 debug_checkpoint_abort          none      "DEBUG SETT… VARCHAR    GLOB…
#>  6 debug_skip_checkpoint_on_commit false     "DEBUG SETT… BOOLEAN    GLOB…
#>  7 storage_compatibility_version   v0.10.2   "Serialize … VARCHAR    GLOB…
#>  8 debug_force_external            false     "DEBUG SETT… BOOLEAN    LOCAL
#>  9 debug_force_no_cross_product    false     "DEBUG SETT… BOOLEAN    LOCAL
#> 10 debug_asof_iejoin               false     "DEBUG SETT… BOOLEAN    LOCAL
#> # ℹ more rows