From 9bdb49076dea14730ec39e6d033061d6bccc016c Mon Sep 17 00:00:00 2001 From: "Laura F. D" Date: Fri, 23 Feb 2018 21:53:02 +0000 Subject: [PATCH] Just do this Signed-off-by: Laura F. D --- asyncqlio/orm/schema/table.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/asyncqlio/orm/schema/table.py b/asyncqlio/orm/schema/table.py index 0d53522..34b97a9 100644 --- a/asyncqlio/orm/schema/table.py +++ b/asyncqlio/orm/schema/table.py @@ -824,7 +824,7 @@ def _get_update_sql(self, emitter: typing.Callable[[], typing.Tuple[str, str]], base_query = io.StringIO() base_query.write("UPDATE {} SET ".format(self.__quoted_name__)) - written_count = 0 + sqls = [] for column in self.table.columns: # lookup the history object # if there is none, there's been no change @@ -834,14 +834,10 @@ def _get_update_sql(self, emitter: typing.Callable[[], typing.Tuple[str, str]], continue response = change.get_update_sql(emitter) - base_query.write(" ") - base_query.write(response.sql) - written_count += 1 - if written_count < len(self.table.columns): - base_query.write(", ") - + sqls.append(response.sql) params.update(response.parameters) + base_query.write(", ".join(sqls)) base_query.write(" WHERE (") where_clauses = 0