use upserts for build db

This commit is contained in:
Luna 2022-10-04 13:58:05 -03:00
parent b09c1b7c74
commit 77466bab7c
1 changed files with 2 additions and 2 deletions

View File

@ -184,7 +184,7 @@ async def main_with_ctx(ctx, wanted_date):
for row in tags_reader:
tag = Tag(int(row[0]), row[1], int(row[2]), int(row[3]))
await ctx.db.execute(
"insert into tags (id, name, category, post_count) values (?, ?, ?, ?)",
"insert into tags (id, name, category, post_count) values (?, ?, ?, ?) on conflict do nothing",
(tag.id, tag.name, tag.category, tag.post_count),
)
processed_count += 1
@ -262,7 +262,7 @@ async def main_with_ctx(ctx, wanted_date):
up_score,
down_score,
is_rating_locked
) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?)
) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?) on conflict do nothing
""",
(
post.id,