Skip to content

Commit 277054c

Browse files
oyarushedarthbear
authored andcommitted
Made column_list as optional parameter (chimpler#6)
1 parent 5869230 commit 277054c

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

aws_s3--0.0.1.sql

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,11 @@ AS $$
9494
else:
9595
s3.download_fileobj(bucket, file_path, fd)
9696
fd.flush()
97-
res = plpy.execute("COPY {table_name} ({column_list}) FROM {filename} {options};".format(
97+
formatted_column_list = "({column_list})".format(column_list=column_list) if column_list else ''
98+
res = plpy.execute("COPY {table_name} {formatted_column_list} FROM {filename} {options};".format(
9899
table_name=table_name,
99100
filename=plpy.quote_literal(fd.name),
100-
column_list=column_list,
101+
formatted_column_list=formatted_column_list,
101102
options=options
102103
)
103104
)
@@ -159,10 +160,11 @@ AS $$
159160
else:
160161
s3.download_fileobj(bucket, file_path, fd)
161162
fd.flush()
162-
res = plpy.execute("COPY {table_name} ({column_list}) FROM {filename} {options};".format(
163+
formatted_column_list = "({column_list})".format(column_list=column_list) if column_list else ''
164+
res = plpy.execute("COPY {table_name} {formatted_column_list} FROM {filename} {options};".format(
163165
table_name=table_name,
164166
filename=plpy.quote_literal(fd.name),
165-
column_list=column_list,
167+
formatted_column_list=formatted_column_list,
166168
options=options
167169
)
168170
)

0 commit comments

Comments
 (0)