MCPcopy Create free account
hub / github.com/apache/arrow / test_open_dataset_from_uri_s3_fsspec

Function test_open_dataset_from_uri_s3_fsspec

python/pyarrow/tests/test_dataset.py:2977–2998  ·  view source on GitHub ↗
(s3_example_simple)

Source from the content-addressed store, hash-verified

2975@pytest.mark.parquet
2976@pytest.mark.s3 # still needed to create the data
2977def test_open_dataset_from_uri_s3_fsspec(s3_example_simple):
2978 table, path, _, _, host, port, access_key, secret_key = s3_example_simple
2979 s3fs = pytest.importorskip("s3fs")
2980
2981 from pyarrow.fs import FSSpecHandler, PyFileSystem
2982
2983 fs = s3fs.S3FileSystem(
2984 key=access_key,
2985 secret=secret_key,
2986 client_kwargs={
2987 'endpoint_url': f'http://{host}:{port}'
2988 }
2989 )
2990
2991 # passing as fsspec filesystem
2992 dataset = ds.dataset(path, format="parquet", filesystem=fs)
2993 assert dataset.to_table().equals(table)
2994
2995 # directly passing the fsspec-handler
2996 fs = PyFileSystem(FSSpecHandler(fs))
2997 dataset = ds.dataset(path, format="parquet", filesystem=fs)
2998 assert dataset.to_table().equals(table)
2999
3000
3001@pytest.mark.parquet

Callers

nothing calls this directly

Calls 4

FSSpecHandlerClass · 0.90
S3FileSystemMethod · 0.80
equalsMethod · 0.80
to_tableMethod · 0.45

Tested by

no test coverage detected