db_compute {RAthena} | R Documentation |
S3 implementation of db_compute
for Athena
Description
This is a backend function for dplyr's compute
function. Users won't be required to access and run this function.
Usage
db_compute.AthenaConnection(con, table, sql, ...)
Arguments
con |
A |
table |
Table name, if left default RAthena will use the default from |
sql |
SQL code to be sent to the data |
... |
passes
|
Value
db_compute
returns table name
See Also
AthenaWriteTables
backend_dbplyr_v2
backend_dbplyr_v1
Examples
## Not run:
# Note:
# - Require AWS Account to run below example.
# - Different connection methods can be used please see `RAthena::dbConnect` documentation
library(DBI)
library(dplyr)
# Demo connection to Athena using profile name
con <- dbConnect(RAthena::athena())
# Write data.frame to Athena table
copy_to(con, mtcars,
s3_location = "s3://mybucket/data/")
# Write Athena table from tbl_sql
athena_mtcars <- tbl(con, "mtcars")
mtcars_filter <- athena_mtcars %>% filter(gear >=4)
# create athena with unique table name
mtcars_filer %>%
compute()
# create athena with specified name and s3 location
mtcars_filer %>%
compute("mtcars_filer",
s3_location = "s3://mybucket/mtcars_filer/")
# Disconnect from Athena
dbDisconnect(con)
## End(Not run)