if (FALSE) {
# Note:
# - Require AWS Account to run below example.
# - Different connection methods can be used please see `RAthena::dbConnect` documnentation
library(DBI)
library(RAthena)
# Demo connection to Athena using profile name
con <- dbConnect(athena())
# write iris table to Athena in defualt delimited format
dbWriteTable(con, "iris", iris)
# convert delimited table to parquet
dbConvertTable(con,
obj = "iris",
name = "iris_parquet",
file.type = "parquet"
)
# Create partitioned table from non-partitioned
# iris table using SQL DML query
dbConvertTable(con,
obj = SQL("select
iris.*,
date_format(current_date, '%Y%m%d') as time_stamp
from iris"),
name = "iris_orc_partitioned",
file.type = "orc",
partition = "time_stamp"
)
# disconnect from Athena
dbDisconnect(con)
}
Run the code above in your browser using DataLab