view py/cleandb.py @ 31:7303535b5a5d

Right-align the numeric columns. The Game.printTable() method now right-aligns the name, rank, and score columns, by giving their cells a different CSS class.
author John "Elwin" Edwards
date Thu, 02 Jan 2014 11:39:57 -0500
parents e8f3b7994d88
children 25843238434a
line wrap: on
line source

#!/usr/bin/python3
# cleandb.py: empty the database in an orderly fashion

import rlgalldb as rlgall
import psycopg2

dbconn = psycopg2.connect("dbname=rlg")
dbcur = dbconn.cursor()

dbcur.execute("UPDATE games SET offbytes = %s", [0])

for game in rlgall.gamelist:
  dbcur.execute("DELETE FROM " + game.uname + ";")

dbcur.execute("DELETE FROM players;")
dbconn.commit()

dbcur.close()
dbconn.close()
exit()