view py/cleandb.py @ 62:df7acc5653b3

Make the final depth appear in Advanced Rogue 5 tables. Along the way, "SELECT name FROM table WHERE name = ..." was removed from any queries where it had been carelessly placed.
author John "Elwin" Edwards
date Fri, 30 Jan 2015 20:24:47 -0500
parents 25843238434a
children
line wrap: on
line source

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

import 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()