Returns a character string that describes the Athena SQL data type for the obj
object.
# S4 method for AthenaDriver,ANY
dbDataType(dbObj, obj, ...)
# S4 method for AthenaDriver,list
dbDataType(dbObj, obj, ...)
# S4 method for AthenaConnection,ANY
dbDataType(dbObj, obj, ...)
# S4 method for AthenaConnection,data.frame
dbDataType(dbObj, obj, ...)
A object inheriting from DBIDriver or DBIConnection
An R object whose SQL type we want to determine.
Other arguments passed on to methods.
dbDataType
returns the Athena type that correspond to the obj argument as an non-empty character string.
library(RAthena)
dbDataType(athena(), 1:5)
#> [1] "INT"
dbDataType(athena(), 1)
#> [1] "DOUBLE"
dbDataType(athena(), TRUE)
#> [1] "BOOLEAN"
dbDataType(athena(), Sys.Date())
#> [1] "DATE"
dbDataType(athena(), Sys.time())
#> [1] "TIMESTAMP"
dbDataType(athena(), c("x", "abc"))
#> [1] "STRING"
dbDataType(athena(), list(raw(10), raw(20)))
#> [1] "STRING"
vapply(iris, function(x) dbDataType(RAthena::athena(), x),
FUN.VALUE = character(1), USE.NAMES = TRUE
)
#> Sepal.Length Sepal.Width Petal.Length Petal.Width Species
#> "DOUBLE" "DOUBLE" "DOUBLE" "DOUBLE" "STRING"
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())
# Sending Queries to Athena
dbDataType(con, iris)
# Disconnect conenction
dbDisconnect(con)
}