Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion pyiceberg/io/fsspec.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ def _adls(properties: Properties) -> AbstractFileSystem:
from azure.core.credentials_async import AsyncTokenCredential

for key, sas_token in {
key.replace(f"{ADLS_SAS_TOKEN}.", ""): value for key, value in properties.items() if key.startswith(ADLS_SAS_TOKEN)
key.replace(f"{ADLS_SAS_TOKEN}.", ""): value for key, value in properties.items() if key.startswith(f"{ADLS_SAS_TOKEN}.")
Copy link
Contributor

@smaheshwar-pltr smaheshwar-pltr Sep 11, 2025

Choose a reason for hiding this comment

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

This looks like the fix for the bug 👍, the Java side gets the props like this with the ADLS_SAS_TOKEN_PREFIX including the ..

}.items():
if ADLS_ACCOUNT_NAME not in properties:
properties[ADLS_ACCOUNT_NAME] = key.split(".")[0]
Expand Down
28 changes: 28 additions & 0 deletions tests/io/test_fsspec.py
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,34 @@ def test_fsspec_pickle_round_trip_aldfs(adls_fsspec_fileio: FsspecFileIO) -> Non
_test_fsspec_pickle_round_trip(adls_fsspec_fileio, "abfss://tests/foo.txt")


@pytest.mark.adls
def test_adls_account_name_sas_token_extraction() -> None:
session_properties: Properties = {
"adls.tenant-id": "test-tenant-id",
"adls.account-host": "testaccount.dfs.core.windows.net",
"adls.sas-token.testaccount.dfs.core.windows.net": "test-sas-token",
"adls.sas-token-expires-at-ms.testaccount.dfs.core.windows.net": "1757597218121",
}

with mock.patch("adlfs.AzureBlobFileSystem") as mock_adlfs:
adls_fileio = FsspecFileIO(properties=session_properties)
filename = str(uuid.uuid4())

adls_fileio.new_input(location=f"abfss://tests/{filename}")

mock_adlfs.assert_called_with(
connection_string=None,
credential=None,
account_name="testaccount",
account_key=None,
sas_token="test-sas-token",
tenant_id="test-tenant-id",
client_id=None,
client_secret=None,
account_host="testaccount.dfs.core.windows.net",
)


@pytest.mark.gcs
def test_fsspec_new_input_file_gcs(fsspec_fileio_gcs: FsspecFileIO) -> None:
"""Test creating a new input file from a fsspec file-io"""
Expand Down