Removes Athena table but does not remove the data from Amazon S3 bucket.

# S4 method for AthenaConnection,character
dbRemoveTable(conn, name, delete_data = TRUE, confirm = 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"')


Deletes S3 files linking to AWS Athena table


Allows for S3 files to be deleted without the prompt check. It is recommend to leave this set to FALSE to avoid deleting other S3 files when the table's definition points to the root of S3 bucket.


Other parameters passed on to methods.


dbRemoveTable() returns TRUE, invisibly.


If you are having difficulty removing AWS S3 files please check if the AWS S3 location following AWS best practises: Table Location in Amazon S3

See also


if (FALSE) {
# Note: 
# - Require AWS Account to run below example.
# - Different connection methods can be used please see `RAthena::dbConnect` documnentation


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

# Write data.frame to Athena table
dbWriteTable(con, "mtcars", mtcars,
             partition=c("TIMESTAMP" = format(Sys.Date(), "%Y%m%d")),
             s3.location = "s3://mybucket/data/")
# Remove Table from Athena
dbRemoveTable(con, "mtcars")

# Disconnect conenction