-
Notifications
You must be signed in to change notification settings - Fork 2.6k
httpfs: check environment vars for AWS Credentials #5419
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Nice functionality! This might be more of a "discussion" but I wonder about supported or intended usage when changing source during say a CLI session, when using multiple S3 sources (see #4337) in a session or query? I guess one could say that I wonder about usage when "reading and setting environment variables after the extension has been loaded". Will it be possible to change environment variables and point to another httpfs S3 source during a session or is the config read and set only once at "load time" when the extension is loaded at "session startup"? Zooming out a little, some of the extensions (for example httpfs, postgres with the libpq connection string, maybe more?) require credentials to be provided, and this is the first one to support credentials to be picked up from environment variables. Am I right in assuming that credentials are generally expected to "remain the same" throughout a session, even while #4608 allows fetching data from different object storage servers or buckets with different credentials in a single query (when explicitly given in the S3 uri)? Related to #4460 (comment) - would "reloading" the environment variables to point to another source cause earlier defined views using "previous credentials" to stop working? |
Does it support the AWS_PROFILE environment variable? |
Not yet. This is a pretty small improvement, intentionally.
This patch just sets
as docs says. But it is not re-reading env vars, so it might be good for us to have a function like |
Yes. In my opinion, if it is view, it should stop. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one small comment, the rest LGTM!
extension/httpfs/s3fs.cpp
Outdated
static char *evar; | ||
|
||
if ((evar = std::getenv(env_var_name)) != NULL) | ||
this->config.options.set_variables[key] = Value(evar); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use DBConfig::SetOption
here?
Thanks for the fixes! Looks good - could you just merge with the feature branch so the CI can re-run? We had some issues with the feature branch in the last few days. |
- Support AWS environment variables - AWS_DEFAULT_REGION - AWS_ACCESS_KEY_ID - AWS_SECRET_ACCESS_KEY - AWS_SESSION_TOKEN - issue duckdb#4021
4cb575a
to
1505440
Compare
I wrongly merged |
Thanks! LGTM |
httpfs
extension is loaded