Skip to content

Commit 4175540

Browse files
committed
fix
1 parent dabd1b1 commit 4175540

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

pyiceberg/io/fsspec.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,12 +197,14 @@ def _adls(properties: Properties) -> AbstractFileSystem:
197197
from adlfs import AzureBlobFileSystem
198198

199199
# https://learn.microsoft.com/en-us/azure/storage/blobs/data-lake-storage-introduction-abfs-uri#uri-syntax
200+
account_uri = None
200201
if not properties.get(ADLS_ACCOUNT_NAME) and (netloc := properties.get("netloc")):
201-
properties[ADLS_ACCOUNT_NAME] = netloc.split("@")[-1].split(".")[0]
202+
account_uri = netloc.split("@")[-1]
203+
properties[ADLS_ACCOUNT_NAME] = account_uri.split(".")[0]
202204

203205
# Fixes https://github.com/apache/iceberg-python/issues/1146
204-
if properties.get(ADLS_ACCOUNT_NAME) and not properties.get(ADLS_SAS_TOKEN):
205-
properties[ADLS_SAS_TOKEN] = properties.get(f"{ADLS_SAS_TOKEN}.{ADLS_ACCOUNT_NAME}.dfs.core.windows.net")
206+
if not properties.get(ADLS_SAS_TOKEN) and account_uri:
207+
properties[ADLS_SAS_TOKEN] = properties.get(f"{ADLS_SAS_TOKEN}.{account_uri}")
206208

207209
return AzureBlobFileSystem(
208210
connection_string=properties.get(ADLS_CONNECTION_STRING),

0 commit comments

Comments
 (0)