mirror of
https://github.com/FAUSheppy/skillbird
synced 2025-12-09 16:08:31 +01:00
[git fast commit] 29. Jan 2019 - 19:00:22
This commit is contained in:
23
PSQL.py
Normal file
23
PSQL.py
Normal file
@@ -0,0 +1,23 @@
|
||||
import psycopg2
|
||||
def save(dname,user,host,password,data):
|
||||
conn = psycopg2.connect("dbname={} user={} host={} password={}".format(dname,user,host,password))
|
||||
cur = conn.cursor()
|
||||
tup = ()
|
||||
if type(data) == dict:
|
||||
for player in data:
|
||||
d = dict()
|
||||
d.update("steamid",p.steamid)
|
||||
d.update("name",p.name)
|
||||
d.update("wins",p.wins)
|
||||
d.update("games",p.games)
|
||||
d.update("mu",p.rating.mu)
|
||||
d.update("sigma",p.rating.sigma)
|
||||
tup += (d,)
|
||||
cur.executemany("""INSERT INTO ratings(steamid,name,wins,games,mu,sigma) \
|
||||
VALUES (%(steamid)s,%(name)s,%(wins)s,%(games)s,%(mu)s,%(sigma)s)""",d)
|
||||
elif isinstance(data,Event):
|
||||
cur.exceutemany("""INSERT INTO events(etype,timestamp,line) \
|
||||
VALUES (%(etype)s,%(timestamp)s,%(line)s)""",data)
|
||||
|
||||
def query_buddies(steamid):
|
||||
return []
|
||||
Reference in New Issue
Block a user