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): Add CredentialProviderAzure parameter to accept user-instantiated azure credential classes #21047

Merged
merged 5 commits into from
Feb 3, 2025

Conversation

nameexhaustion
Copy link
Collaborator

@nameexhaustion nameexhaustion commented Feb 3, 2025

ref #18931 (comment)

Introduces a credentials parameter to CredentialProviderAzure, which can provide a QoL improvement, as users can then do:

pl.scan_parquet(
    "abfss://...@.../...",
    credential_provider=pl.CredentialProviderAzure(
        credentials=DefaultAzureCredential(exclude_managed_identity_credential=True)
    ),
)

instead of:

def credential_provider():
    credential = DefaultAzureCredential(exclude_managed_identity_credential=True)
    token = credential.get_token("https://storage.azure.com/.default")

    return {"bearer_token": token.token}, token.expires_on


pl.scan_parquet(
    "abfss://...@.../...",
    credential_provider=credential_provider,
)

Also adds the above example to the user guide

@github-actions github-actions bot added enhancement New feature or an improvement of an existing feature python Related to Python Polars labels Feb 3, 2025
Copy link

codecov bot commented Feb 3, 2025

Codecov Report

Attention: Patch coverage is 0% with 8 lines in your changes missing coverage. Please review.

Project coverage is 79.27%. Comparing base (db712e4) to head (65985df).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
py-polars/polars/io/cloud/credential_provider.py 0.00% 8 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #21047      +/-   ##
==========================================
- Coverage   79.28%   79.27%   -0.01%     
==========================================
  Files        1583     1583              
  Lines      225549   225554       +5     
  Branches     2586     2588       +2     
==========================================
+ Hits       178816   178818       +2     
- Misses      46143    46146       +3     
  Partials      590      590              

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

@nameexhaustion nameexhaustion changed the title feat(python): Add CredentialProviderAzure parameter to accept user-instantiated azure credentials classes feat(python): Add CredentialProviderAzure parameter to accept user-instantiated azure credential classes Feb 3, 2025
@nameexhaustion nameexhaustion marked this pull request as ready for review February 3, 2025 07:07
@ritchie46 ritchie46 merged commit 2541157 into pola-rs:main Feb 3, 2025
26 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.

Allow to explicitly specify Azure TokenCredential in storage_options
2 participants