Skip to content

Commit

Permalink
export with the origin name for the first file.
Browse files Browse the repository at this point in the history
  • Loading branch information
zlianzhuang committed Mar 24, 2023
1 parent 98c3cd2 commit a391a4b
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions aws_s3--1.0.0.sql
Original file line number Diff line number Diff line change
Expand Up @@ -243,10 +243,13 @@ AS $$
file_path_parts = re.match(r'^(.*?)(\.[^.]*$|$)', upload_file_path)
base_name = file_path_parts.group(1)
extension = file_path_parts.group(2)
counter = 0
while file_exists(bucket, get_unique_file_path(base_name, counter, extension), s3):
counter += 1
upload_file_path = get_unique_file_path(base_name, counter, extension)
if not file_exists(bucket, file_path, s3):
upload_file_path = file_path
else:
counter = 1
while file_exists(bucket, get_unique_file_path(base_name, counter, extension), s3):
counter += 1
upload_file_path = get_unique_file_path(base_name, counter, extension)

with tempfile.NamedTemporaryFile(dir=tempfile_dir) as fd:
plan = plpy.prepare(
Expand Down

0 comments on commit a391a4b

Please sign in to comment.