Skip to content
This repository has been archived by the owner on May 13, 2019. It is now read-only.

Commit

Permalink
Just do this
Browse files Browse the repository at this point in the history
Signed-off-by: Laura F. D <[email protected]>
  • Loading branch information
Fuyukai committed Feb 23, 2018
1 parent e09cf69 commit 9bdb490
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions asyncqlio/orm/schema/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down

0 comments on commit 9bdb490

Please sign in to comment.