Skip to content

Commit 48d9edc

Browse files
authored
Update _write.py
1 parent 970c4f7 commit 48d9edc

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

awswrangler/s3/_write.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,9 +277,20 @@ def write( # noqa: PLR0913
277277
partition_cols = partition_cols if partition_cols else []
278278
dtype = dtype if dtype else {}
279279
partitions_values: dict[str, list[str]] = {}
280-
mode = "append" if mode is None else mode
281280

282-
filename_prefix = filename_prefix + uuid.uuid4().hex if filename_prefix else uuid.uuid4().hex
281+
if mode == "overwrite_files":
282+
if filename_prefix is None:
283+
filename_prefix = "part"
284+
random_filename_suffix = ""
285+
mode = "append"
286+
else:
287+
random_filename_suffix = uuid.uuid4().hex
288+
289+
if filename_prefix is None:
290+
filename_prefix = ""
291+
filename_prefix = filename_prefix + random_filename_suffix
292+
293+
mode = "append" if mode is None else mode
283294
cpus: int = _utils.ensure_cpu_count(use_threads=use_threads)
284295
s3_client = _utils.client(service_name="s3", session=boto3_session)
285296

0 commit comments

Comments
 (0)