Comments (5)
OK I've made some progress! This comment is a great reference. But still unclear why the s3_staging_dir
can't be read from the config
file.
# .aws/config
[profile my-profile-master]
region = us-east-1
output = json
[profile my-profile-foo]
source_profile = my-profile-master
include_profile = my-profile-master
s3_staging_dir = s3://foo/bar/baz
schema_name = blah
duration_seconds = 3600
role_arn = arn:aws:iam::1234567890:role/Name-Of-Role
work_group = my-foo-bar-workgroup
# ❌ doesn't work
con <- DBI::dbConnect(noctua::athena(),
region = "us-east-1",
profile_name = "my-profile-foo"
)
Error: Please set
s3_staging_dir
either in parameters3_staging_dir
, environmental varaibleAWS_ATHENA_S3_STAGING_DIR
or when work_group is defined increate_work_group()
However, this works:
# ✅ works
con <- DBI::dbConnect(noctua::athena(),
region = "us-east-1",
profile_name = "my-profile-foo",
s3_staging_dir = "s3://foo/bar/baz"
)
Is there a way to make DBI::dbConnect()
read the s3_staging_dir
value from the config
file?
from noctua.
Hi @emmansh,
Currently notua only gets AWS values from .aws/config and .aws/credentials (https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html). This is done through paws sdk. However noctua does allow environment variables to be set as well. So for example all aws config setting can be store in .aws/config or .aws/credentials and noctua setting can be stored as environmental variables.
To do this you can use the R package usethis
. This can set environment variables in the .Renviron
file.
usethis::edit_r_environ()
AWS_ATHENA_S3_STAGING_DIR=s3://my-athena-bucket/query/location/
After reseting your session, AWS_ATHENA_S3_STAGING_DIR will be available. You can then set up a connection:
con <- dbConnect(noctua::athena(), profile = "my-profile-foo")
I hope this helps :)
Note: if you are using an Athena work group. noctua
will attempt to retrieve the S3 staging dir from it. So you won't need to hard code it :)
from noctua.
Here are a list of supported environmental variables that aren't in .aws/config or .aws/credentials.
- AWS_ATHENA_S3_STAGING_DIR: is equivalent to the dbConnect parameter - s3_staging_dir
- AWS_ATHENA_WORK_GROUP: is equivalent to dbConnect parameter - work_group
from noctua.
I am happy for any PRs if you would like to add this feature to noctua :)
from noctua.
Sounds good, thank you!
from noctua.
Related Issues (20)
- Prevent Noctua from printing Data Scanned -information HOT 7
- Release noctua 2.5.0 HOT 3
- Release noctua 2.6.0 HOT 1
- Sub-query fails with dplyr interface indicating "Only one sql statement is allowed" HOT 6
- cran-2.6.1 release
- Add catalog support HOT 26
- Column Bucketing
- Allow for Partition columns to change data types
- Can't write/append an empty data frame
- Connecting using long-term-creds returns Error 400 HOT 5
- dbFetch(..., n=small number) is quite slow when run on a large result set HOT 4
- `dbExistsTable()` doesn't work anymore HOT 3
- fix: for dbplyr 2.3.3.9000 +
- dbExistsTable() returns an incorrect result when the table name is defined by Id() or SQL() HOT 1
- InvalidRequestException with dbGetQuery HOT 4
- [Question]: Requesting guidance and best practices - Athena shinyApp with noctua HOT 2
- Unload option returns `null` results when `s3_staging_dir` is a bucket only HOT 1
- Speeding up `noctua` installation by cutting down unnecessary pieces HOT 3
- Add support for describe? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from noctua.