use psycopg's SQL quoting where possible

Use the SQL formatting supplied with psycopg whenever the
query needs to be put together from snippets.
This commit is contained in:
Sarah Hoffmann
2021-07-12 22:05:22 +02:00
parent 6f6681ce67
commit 14f777da18
5 changed files with 58 additions and 42 deletions

View File

@@ -383,9 +383,9 @@ class LegacyICUNameAnalyzer:
if word_tokens:
cur.execute("""INSERT INTO word (word_id, word_token, country_code,
search_name_count)
(SELECT nextval('seq_word'), token, '{}', 0
(SELECT nextval('seq_word'), token, %s, 0
FROM unnest(%s) as token)
""".format(country_code), (list(word_tokens),))
""", (country_code, list(word_tokens)))
def process_place(self, place):