Skip to contents

presto_default() works similarly but returns a connection on success and throws a testthat skip condition on failure, making it suitable for use in tests.

RPresto examples and tests connect to a default database via dbConnect(Presto(), ...). This function checks if that database is available, and if not, displays an informative message.

Usage

presto_default(...)

presto_has_default(...)

Arguments

...

Additional arguments passed on to dbConnect()

Examples

if (presto_has_default()) {
  db <- presto_default()
  print(dbListTables(db))
  dbDisconnect(db)
} else {
  message("No database connection.")
}
#> [1] "iris"                    "presto_array_of_maps"   
#> [3] "presto_array_of_rows"    "presto_primitive_arrays"
#> [5] "presto_primitive_maps"   "presto_primitive_rows"  
#> [7] "presto_primitive_types" 
#> [1] TRUE