use upserts for build db
This commit is contained in:
parent
b09c1b7c74
commit
77466bab7c
1 changed files with 2 additions and 2 deletions
|
@ -184,7 +184,7 @@ async def main_with_ctx(ctx, wanted_date):
|
||||||
for row in tags_reader:
|
for row in tags_reader:
|
||||||
tag = Tag(int(row[0]), row[1], int(row[2]), int(row[3]))
|
tag = Tag(int(row[0]), row[1], int(row[2]), int(row[3]))
|
||||||
await ctx.db.execute(
|
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),
|
(tag.id, tag.name, tag.category, tag.post_count),
|
||||||
)
|
)
|
||||||
processed_count += 1
|
processed_count += 1
|
||||||
|
@ -262,7 +262,7 @@ async def main_with_ctx(ctx, wanted_date):
|
||||||
up_score,
|
up_score,
|
||||||
down_score,
|
down_score,
|
||||||
is_rating_locked
|
is_rating_locked
|
||||||
) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?)
|
) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?) on conflict do nothing
|
||||||
""",
|
""",
|
||||||
(
|
(
|
||||||
post.id,
|
post.id,
|
||||||
|
|
Loading…
Reference in a new issue