Skip to content

Commit 7ae7adc

Browse files
fix: s3.read_parquet_metadata not throwing proper error for empty path (#2843)
1 parent 7ed588e commit 7ae7adc

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

awswrangler/s3/_read.py

+4
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,10 @@ def read_table_metadata(
265265
ignore_empty=ignore_empty,
266266
s3_additional_kwargs=s3_additional_kwargs,
267267
)
268+
269+
if len(paths) < 1:
270+
raise exceptions.NoFilesFound(f"No files Found: {path}.")
271+
268272
version_ids = _check_version_id(paths=paths, version_id=version_id)
269273

270274
# Files

tests/unit/test_s3_parquet.py

+5
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@ def test_read_parquet_metadata_nulls(path):
5757
assert columns_types.get("c2") == "string"
5858

5959

60+
def test_read_parquet_metadata_nonexistent_file(path):
61+
with pytest.raises(wr.exceptions.NoFilesFound):
62+
wr.s3.read_parquet_metadata(path + "non-existent-file.parquet")
63+
64+
6065
@pytest.mark.parametrize(
6166
"partition_cols",
6267
[

0 commit comments

Comments
 (0)