Add random position.

main
Joshua Potter 2023-12-07 08:08:53 -07:00
parent 44a18fc59c
commit 8f21cb64af
2 changed files with 7 additions and 1 deletions

View File

@ -1,3 +1,4 @@
import random
import sys
from datetime import datetime
from typing import List, Literal
@ -129,6 +130,7 @@ def upsert_row(conn, row: Row):
, rapid
, blitz
, bullet
, position
)
VALUES
( %s
@ -140,6 +142,7 @@ def upsert_row(conn, row: Row):
, %s
, %s
, %s
, %s
)
ON CONFLICT
(site, username)
@ -150,7 +153,8 @@ def upsert_row(conn, row: Row):
languages = EXCLUDED.languages,
rapid = EXCLUDED.rapid,
blitz = EXCLUDED.blitz,
bullet = EXCLUDED.bullet;
bullet = EXCLUDED.bullet,
position = EXCLUDED.position;
""",
[
row["site"].value,
@ -162,6 +166,7 @@ def upsert_row(conn, row: Row):
row.get("rapid"),
row.get("blitz"),
row.get("bullet"),
random.randint(0, 1000000),
],
)
conn.commit()

View File

@ -13,6 +13,7 @@ CREATE TABLE coach_scraper.export
, rapid INT
, blitz INT
, bullet INT
, position INT
);
CREATE UNIQUE INDEX IF NOT EXISTS