From d87025ad3a3086b7ba66ea4dc733e3cfdec47066 Mon Sep 17 00:00:00 2001 From: Marc Bonnici Date: Wed, 17 Jul 2019 11:38:20 +0100 Subject: [PATCH] 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. --- wa/utils/postgres.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/wa/utils/postgres.py b/wa/utils/postgres.py index 1bedbbc6..19a29f7a 100644 --- a/wa/utils/postgres.py +++ b/wa/utils/postgres.py @@ -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