1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-01-31 02:01:16 +00:00

output_processors/postgres: Fix empty iterable

In the case of an empty iterable an empty string would be returned
however this was not an valid value so ensure that the brackets are
always inserted into the output.
This commit is contained in:
Marc Bonnici 2019-07-17 11:38:20 +01:00
parent ac5819da8e
commit d87025ad3a

View File

@ -199,7 +199,6 @@ def create_iterable_adapter(array_columns, explicit_iterate=False):
array_string = "{" + array_string + "}"
final_string = final_string + array_string + ","
final_string = final_string.strip(",")
final_string = "{" + final_string + "}"
else:
# Simply return each item in the array
if explicit_iterate:
@ -208,8 +207,7 @@ def create_iterable_adapter(array_columns, explicit_iterate=False):
else:
for item in param:
final_string = final_string + str(item) + ","
final_string = "{" + final_string + "}"
return AsIs("'{}'".format(final_string))
return AsIs("'{{{}}}'".format(final_string))
return adapt_iterable