dbGetPartition: Athena table partitions

dbGetPartitionR Documentation

Athena table partitions


This method returns all partitions from Athena table.


dbGetPartition(conn, name, ..., .format = FALSE)

## S4 method for signature 'AthenaConnection'
dbGetPartition(conn, name, ..., .format = FALSE)



A DBIConnection object, as returned by dbConnect().


The table name, passed on to dbQuoteIdentifier(). Options are:

  • a character string with the unquoted DBMS table name, e.g. "table_name",

  • a call to Id() with components to the fully qualified table name, e.g. Id(schema = "my_schema", table = "table_name")

  • a call to SQL() with the quoted and fully qualified table name given verbatim, e.g. SQL('"my_schema"."table_name"')


Other parameters passed on to methods.


re-formats AWS Athena partitions format. So that each column represents a partition from the AWS Athena table. Default set to FALSE to prevent breaking previous package behaviour.


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


## Not run: 
# Note:
# - Require AWS Account to run below example.
# - Different connection methods can be used please see `noctua::dbConnect` documnentation


# Demo connection to Athena using profile name
con <- dbConnect(noctua::athena())

# write iris table to Athena
dbWriteTable(con, "iris",
  partition = c("timestamp" = format(Sys.Date(), "%Y%m%d")),
  s3.location = "s3://path/to/store/athena/table/"

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

# disconnect from Athena

## End(Not run)

noctua documentation built on Aug. 9, 2023, 1:07 a.m.