DyfanJones / noctua

Connect R to Athena using paws SDK (DBI Interface)
https://dyfanjones.github.io/noctua/
Other
45 stars 5 forks source link

Fix buckets with no key prefix in `unload = TRUE` related functions #215

Closed dfsnow closed 2 months ago

dfsnow commented 3 months ago

This PR makes two minor changes to fix the issues described in #214. Mainly, it allows passing a bucket path with no key prefix when using the unload = TRUE option in dbGetQuery() and similar functions.

To illustrate, the setup below currently returns correct results:

con <- DBI::dbConnect(noctua::athena(), s3_staging_dir = "s3://temp-bucket/test/")
dbGetQuery(conn = con, "SELECT * FROM test_db", unload = TRUE)

But the following two setups do not:

con <- DBI::dbConnect(noctua::athena(), s3_staging_dir = "s3://temp-bucket/")
dbGetQuery(conn = con, "SELECT * FROM test_db", unload = TRUE)
con <- DBI::dbConnect(noctua::athena(), s3_staging_dir = "s3://temp-bucket")
dbGetQuery(conn = con, "SELECT * FROM test_db", unload = TRUE)

Closes #214.