Skip to content
Merged
Changes from 4 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
11 changes: 11 additions & 0 deletions pyiceberg/io/pyarrow.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,12 @@
ADLS_ACCOUNT_NAME,
ADLS_BLOB_STORAGE_AUTHORITY,
ADLS_BLOB_STORAGE_SCHEME,
ADLS_CLIENT_ID,
ADLS_CLIENT_SECRET,
ADLS_DFS_STORAGE_AUTHORITY,
ADLS_DFS_STORAGE_SCHEME,
ADLS_SAS_TOKEN,
ADLS_TENANT_ID,
AWS_ACCESS_KEY_ID,
AWS_REGION,
AWS_ROLE_ARN,
Expand Down Expand Up @@ -501,6 +504,7 @@ def _initialize_s3_fs(self, netloc: Optional[str]) -> FileSystem:
return S3FileSystem(**client_kwargs)

def _initialize_azure_fs(self) -> FileSystem:
# https://arrow.apache.org/docs/python/generated/pyarrow.fs.AzureFileSystem.html
from packaging import version

MIN_PYARROW_VERSION_SUPPORTING_AZURE_FS = "20.0.0"
Expand Down Expand Up @@ -535,6 +539,13 @@ def _initialize_azure_fs(self) -> FileSystem:
if sas_token := self.properties.get(ADLS_SAS_TOKEN):
client_kwargs["sas_token"] = sas_token

if client_id := self.properties.get(ADLS_CLIENT_ID):
client_kwargs["client_id"] = client_id
if client_secret := self.properties.get(ADLS_CLIENT_SECRET):
client_kwargs["client_secret"] = client_secret
if tenant_id := self.properties.get(ADLS_TENANT_ID):
client_kwargs["tenant_id"] = tenant_id
Comment on lines +542 to +547
Copy link
Contributor

Choose a reason for hiding this comment

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

The client_id, client_secret and tenant_id should be provided together, should we raise a ValueError? This way we hide Arrow exceptions where possible.

image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

makes sense, added!


return AzureFileSystem(**client_kwargs)

def _initialize_hdfs_fs(self, scheme: str, netloc: Optional[str]) -> FileSystem:
Expand Down