Skip to content

Commit 752b63f

Browse files
committed
create dir first
1 parent 369df6e commit 752b63f

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

pyiceberg/io/pyarrow.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,8 @@ def create(self, overwrite: bool = False) -> OutputStream:
288288
try:
289289
if not overwrite and self.exists() is True:
290290
raise FileExistsError(f"Cannot create file, already exists: {self.location}")
291+
# Parent directories must be created first in certain file systems, such as the LocalFileSystem.
292+
self._filesystem.create_dir(os.path.dirname(self._path), recursive=True)
291293
output_file = self._filesystem.open_output_stream(self._path, buffer_size=self._buffer_size)
292294
except PermissionError:
293295
raise

0 commit comments

Comments
 (0)