Skip to content
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

Added profile_name to boto3 Session #382

Merged
merged 1 commit into from
Apr 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions dbt/adapters/duckdb/credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,11 @@ def load_settings(self) -> Dict[str, str]:
settings = self.settings or {}
if self.use_credential_provider:
if self.use_credential_provider == "aws":
settings.update(_load_aws_credentials(ttl=_get_ttl_hash()))
settings.update(
_load_aws_credentials(
ttl=_get_ttl_hash(), profile=settings.get("s3_profile")
),
)
else:
raise ValueError(
"Unsupported value for use_credential_provider: "
Expand All @@ -248,7 +252,7 @@ def _get_ttl_hash(seconds=300):


@lru_cache()
def _load_aws_credentials(ttl=None) -> Dict[str, Any]:
def _load_aws_credentials(ttl=None, profile="default") -> Dict[str, Any]:
"""
Load AWS credentials from the environment.

Expand All @@ -260,7 +264,7 @@ def _load_aws_credentials(ttl=None) -> Dict[str, Any]:
del ttl # make mypy happy
import boto3.session

session = boto3.session.Session()
session = boto3.session.Session(profile_name=profile)

# use STS to verify that the credentials are valid; we will
# raise a helpful error here if they are not
Expand Down
Loading