From c06193e613c3ed66dc52d82440d6fac9f54de5d4 Mon Sep 17 00:00:00 2001 From: Eunhak Lee <lee@enak.kr> Date: Sun, 8 Dec 2024 05:47:37 +0900 Subject: [PATCH] =?UTF-8?q?chore:=20=EB=B6=80=ED=92=88=20=EC=9C=A0?= =?UTF-8?q?=ED=98=95=20=EB=B3=84=20=EA=B8=B0=EB=B3=B8=20=EC=9D=B4=EB=AF=B8?= =?UTF-8?q?=EC=A7=80=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- push_to_db.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/push_to_db.py b/push_to_db.py index 8af327a..31a5433 100644 --- a/push_to_db.py +++ b/push_to_db.py @@ -61,11 +61,11 @@ def create_new_one(_dict, part_type, _cursor): columns = ", ".join([f'"{key}"' for key, _ in _obj]) values = [value for _, value in _obj] - sql = """WITH rows AS (INSERT INTO parts (name, type) VALUES (%s, %s) ON CONFLICT (name) DO UPDATE SET name = excluded.name RETURNING id) + sql = """WITH rows AS (INSERT INTO parts (name, type, image_url) VALUES (%s, %s, %s) ON CONFLICT (name) DO UPDATE SET name = excluded.name RETURNING id) INSERT INTO part_info_{type} (part_id, {columns}) (SELECT rows.id, {value_entries} FROM rows) RETURNING part_id;""".format(type=_part_type_enum, columns=columns, value_entries=", ".join(["%s"] * len(values))) - _cursor.execute(sql, (name, _part_type_enum, *values)) + _cursor.execute(sql, (name, _part_type_enum, "/static/img/placeholder/{}.png".format(part_type.lower()), *values)) data = _cursor.fetchall() if data: -- GitLab