-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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: Add credential provider utility classes for AWS, GCP #19297
Merged
+375
−28
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
de64dba
c
nameexhaustion 5ad0642
c
nameexhaustion 92103b3
c
nameexhaustion 01625e8
c
nameexhaustion fbbcbdc
c
nameexhaustion 3b5fe36
c
nameexhaustion 128f029
c
nameexhaustion 1aeeda6
default to None
nameexhaustion 773cb35
c
nameexhaustion 50e5172
c
nameexhaustion 38fba2c
c
nameexhaustion eaaec47
c
nameexhaustion bb78ff4
c
nameexhaustion aa1af98
c
nameexhaustion f8eddf5
c
nameexhaustion c5afc7a
ensure `storage_options=None` for auto
nameexhaustion File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
from polars.io.cloud.credential_provider import ( | ||
CredentialProvider, | ||
CredentialProviderAWS, | ||
CredentialProviderFunction, | ||
CredentialProviderFunctionReturn, | ||
CredentialProviderGCP, | ||
) | ||
|
||
__all__ = [ | ||
"CredentialProvider", | ||
"CredentialProviderAWS", | ||
"CredentialProviderFunction", | ||
"CredentialProviderFunctionReturn", | ||
"CredentialProviderGCP", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
from __future__ import annotations | ||
|
||
from pathlib import Path | ||
from typing import TYPE_CHECKING, Literal | ||
|
||
from polars._utils.various import is_path_or_str_sequence | ||
|
||
if TYPE_CHECKING: | ||
from polars._typing import ScanSource | ||
|
||
|
||
def _first_scan_path( | ||
source: ScanSource, | ||
) -> str | Path | None: | ||
if isinstance(source, (str, Path)): | ||
return source | ||
elif is_path_or_str_sequence(source) and source: | ||
return source[0] | ||
|
||
return None | ||
|
||
|
||
def _infer_cloud_type( | ||
source: ScanSource, | ||
) -> Literal["aws", "azure", "gcp", "file", "http", "hf"] | None: | ||
if (path := _first_scan_path(source)) is None: | ||
return None | ||
|
||
splitted = str(path).split("://", maxsplit=1) | ||
|
||
# Fast path - local file | ||
if not splitted: | ||
return None | ||
|
||
scheme = splitted[0] | ||
|
||
if scheme == "file": | ||
return "file" | ||
|
||
if any(scheme == x for x in ["s3", "s3a"]): | ||
return "aws" | ||
|
||
if any(scheme == x for x in ["az", "azure", "adl", "abfs", "abfss"]): | ||
return "azure" | ||
|
||
if any(scheme == x for x in ["gs", "gcp", "gcs"]): | ||
return "gcp" | ||
|
||
if any(scheme == x for x in ["http", "https"]): | ||
return "http" | ||
|
||
if scheme == "hf": | ||
return "hf" | ||
|
||
return None |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Also added to the Python docs, but everything has been marked unstable