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

feat(python): AssumeRole support for AWS Credential Provider #19346

Merged
merged 6 commits into from
Oct 22, 2024

Conversation

nameexhaustion
Copy link
Collaborator

@nameexhaustion nameexhaustion commented Oct 21, 2024

Adds support for using an assumed role to CredentialProviderAWS

pl.scan_parquet(
    "s3://.../...",
    credential_provider=pl.CredentialProviderAWS(
        assume_role={
            "RoleArn": "arn:aws:iam::0000000:role/ExampleRole",
            "RoleSessionName": "example",
        }
    ),
)

ref #18979
ref #15838

@github-actions github-actions bot added enhancement New feature or an improvement of an existing feature python Related to Python Polars labels Oct 21, 2024
return None if not splitted else splitted[0]


def _is_aws_cloud(scheme: str) -> bool:
Copy link
Collaborator Author

@nameexhaustion nameexhaustion Oct 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

refactored to remove the exhaustive cloud-type identification - we only need AWS and GCP for now

also more efficient to use these functions directly as we avoid double-matching

tzinfo=zoneinfo.ZoneInfo("UTC")
(
expiry.replace(tzinfo=zoneinfo.ZoneInfo("UTC"))
if expiry.tzinfo is None
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

drive-by - in case a future version of google auth adds timezone info

@nameexhaustion nameexhaustion changed the title feat(python): AssumeRole support for CredentialProviderAWS feat(python): AssumeRole support for AWS Credential Provider Oct 21, 2024
Copy link

codecov bot commented Oct 21, 2024

Codecov Report

Attention: Patch coverage is 58.97436% with 16 lines in your changes missing coverage. Please review.

Project coverage is 80.23%. Comparing base (08732c4) to head (63dd0c0).
Report is 21 commits behind head on main.

Files with missing lines Patch % Lines
py-polars/polars/io/cloud/credential_provider.py 53.12% 13 Missing and 2 partials ⚠️
py-polars/polars/io/cloud/_utils.py 85.71% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #19346      +/-   ##
==========================================
+ Coverage   80.21%   80.23%   +0.01%     
==========================================
  Files        1523     1523              
  Lines      209544   209579      +35     
  Branches     2434     2430       -4     
==========================================
+ Hits       168096   168148      +52     
+ Misses      40893    40878      -15     
+ Partials      555      553       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ritchie46 ritchie46 merged commit e8cfa44 into pola-rs:main Oct 22, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or an improvement of an existing feature python Related to Python Polars
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants