Add random position.
parent
44a18fc59c
commit
8f21cb64af
|
@ -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()
|
||||
|
|
|
@ -13,6 +13,7 @@ CREATE TABLE coach_scraper.export
|
|||
, rapid INT
|
||||
, blitz INT
|
||||
, bullet INT
|
||||
, position INT
|
||||
);
|
||||
|
||||
CREATE UNIQUE INDEX IF NOT EXISTS
|
||||
|
|
Loading…
Reference in New Issue