Access and Query Amazon Athena via DBI/JDBC
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
979 B

context("Driver & queries work")
skip_on_cran()
drv <- metis::Athena()
expect_is(drv, "AthenaDriver")
if (identical(Sys.getenv("TRAVIS"), "true")) {
metis::dbConnect(
drv = drv,
Schema = "sampledb",
S3OutputLocation = "s3://aws-athena-query-results-569593279821-us-east-1",
) -> con
} else {
metis::dbConnect(
drv = drv,
Schema = "sampledb",
AwsCredentialsProviderClass = "com.simba.athena.amazonaws.auth.PropertiesFileCredentialsProvider",
AwsCredentialsProviderArguments = path.expand("~/.aws/athenaCredentials.props"),
S3OutputLocation = "s3://aws-athena-query-results-569593279821-us-east-1",
) -> con
}
expect_is(con, "AthenaConnection")
expect_equal(dbListTables(con, schema="sampledb"), "elb_logs")
expect_true(dbExistsTable(con, "elb_logs", schema="sampledb"))
expect_true("url" %in% dbListFields(con, "elb_logs", "sampledb"))
expect_is(
dbGetQuery(con, "SELECT * FROM sampledb.elb_logs LIMIT 10"),
"data.frame"
)