This method tests whether the dbObj
is still valid.
# S4 method for AthenaConnection
dbIsValid(dbObj, ...)
# S4 method for AthenaResult
dbIsValid(dbObj, ...)
An object inheriting from DBIObject, i.e. DBIDriver, DBIConnection, or a DBIResult
Other arguments to methods.
dbIsValid()
returns logical scalar, TRUE
if the object (dbObj
) is valid, FALSE
otherwise.
if (FALSE) {
# Note:
# - Require AWS Account to run below example.
# - Different connection methods can be used please see `RAthena::dbConnect` documnentation
library(DBI)
# Demo connection to Athena using profile name
con <- dbConnect(RAthena::athena())
# Check is connection is valid
dbIsValid(con)
# Check is query is valid
res <- dbSendQuery(con, "show databases")
dbIsValid(res)
# Check if query is valid after clearing result
dbClearResult(res)
dbIsValid(res)
# Check if connection if valid after closing connection
dbDisconnect(con)
dbIsValid(con)
}