Skip to content
Open
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
7 changes: 7 additions & 0 deletions pyiceberg/io/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@
GCS_VERSION_AWARE = "gcs.version-aware"
HF_ENDPOINT = "hf.endpoint"
HF_TOKEN = "hf.token"
COS_SECRET_ID = "cos.secret-id"
COS_SECRET_KEY = "cos.secret-key"
COS_SESSION_TOKEN = "cos.session-token"
COS_REGION = "cos.region"
COS_ENDPOINT = "cos.endpoint"


@runtime_checkable
Expand Down Expand Up @@ -314,6 +319,8 @@ def delete(self, location: str | InputFile | OutputFile) -> None:
"wasb": [FSSPEC_FILE_IO, ARROW_FILE_IO],
"wasbs": [FSSPEC_FILE_IO, ARROW_FILE_IO],
"hf": [FSSPEC_FILE_IO],
"cosn": [FSSPEC_FILE_IO],
"cos": [FSSPEC_FILE_IO],
}


Expand Down
19 changes: 19 additions & 0 deletions pyiceberg/io/fsspec.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@
InputStream,
OutputFile,
OutputStream,
COS_ENDPOINT,
COS_REGION,
COS_SECRET_ID,
COS_SECRET_KEY,
COS_SESSION_TOKEN,
)
from pyiceberg.typedef import Properties
from pyiceberg.types import strtobool
Expand Down Expand Up @@ -303,6 +308,18 @@ def _hf(properties: Properties) -> AbstractFileSystem:
token=properties.get(HF_TOKEN),
)

def _cosn(properties: Properties) -> AbstractFileSystem:
from cosfs import CosFileSystem

token = properties.get(COS_SESSION_TOKEN) or None

return CosFileSystem(
secret_id=properties.get(COS_SECRET_ID),
secret_key=properties.get(COS_SECRET_KEY),
token=token,
endpoint=properties.get(COS_ENDPOINT),
region=properties.get(COS_REGION),
)

SCHEME_TO_FS: dict[str, Callable[..., AbstractFileSystem]] = {
"": _file,
Expand All @@ -315,6 +332,8 @@ def _hf(properties: Properties) -> AbstractFileSystem:
"gs": _gs,
"gcs": _gs,
"hf": _hf,
"cosn": _cosn,
"cos": _cosn,
}

_ADLS_SCHEMES = frozenset({"abfs", "abfss", "wasb", "wasbs"})
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ datafusion = ["datafusion>=52,<53"]
gcp-auth = ["google-auth>=2.4.0"]
entra-auth = ["azure-identity>=1.25.1"]
geoarrow = ["geoarrow-pyarrow>=0.2.0"]
cosfs = ["cosfs>=2026.3.25"]

[dependency-groups]
dev = [
Expand Down
Loading