Learn R Programming

RAthena (version 1.7.0)

dbGetPartition: Athena table partitions

Description

This method returns all partitions from Athena table.

Usage

dbGetPartition(conn, name, ...)

# S4 method for AthenaConnection dbGetPartition(conn, name, ...)

Arguments

conn

A '>DBIConnection object, as returned by dbConnect().

name

A character string specifying a DBMS table name.

...

Other parameters passed on to methods.

Value

data.frame that returns all partitions in table, if no partitions in Athena table then function will return error from Athena.

Examples

Run this code
# NOT RUN {
# 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())
                 
# write iris table to Athena                  
dbWriteTable(con, "iris",
             iris,
             partition = c("timestamp" = format(Sys.Date(), "%Y%m%d")),
             s3.location = "s3://path/to/store/athena/table/")

# return table partitions
RAthena::dbGetPartition(con, "iris")

# disconnect from Athena
dbDisconnect(con)
# }

Run the code above in your browser using DataLab