use upserts for build db

mistress
Luna 4 months ago
parent b09c1b7c74
commit 77466bab7c

@ -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,

Loading…
Cancel
Save