1
FAQ / Re: Slow down reasons and possible fixes - An Aurora C# guide
« Last post by superstrijder15 on July 31, 2023, 09:39:48 AM »If you have a DB and you have an old game in there for some reason, you can delete all other games from your current one by doing this in python:
import sqlite3
import pandas as pd
dbfile = "AuroraDB.db"
con = sqlite3.connect(dbfile)
cur = con.cursor()
cur.execute("SELECT name FROM sqlite_master WHERE type = 'table';")
tables = [a[0] for a in cur.fetchall()]
gametables = pd.read_sql_query("""SELECT m.name as tableName,
p.name as columnName
FROM sqlite_master m, pragma_table_info((m.name)) p
WHERE m.name <> p.name and p.name = 'GameID'
order by tableName, p.cid
;""", con)
con.close()
con = sqlite3.connect(dbfile)
cur = con.cursor()
total_rowcount = 0
for table in gametables["tableName"]:
cur.execute(f"DELETE FROM {table} WHERE {table}.GameID <> Your Game ID here")
total_rowcount += cur.rowcount
print(cur.rowcount)
con.commit()
print("Total", total_rowcount, "Records updated successfully")
cur.close()
con.close()
Find your gameID by making sure you ran some eventful turns of your desired game, and using the browser above or running a query to find the last item in your FCT_GameLog table and its gameID
import sqlite3
import pandas as pd
dbfile = "AuroraDB.db"
con = sqlite3.connect(dbfile)
cur = con.cursor()
cur.execute("SELECT name FROM sqlite_master WHERE type = 'table';")
tables = [a[0] for a in cur.fetchall()]
gametables = pd.read_sql_query("""SELECT m.name as tableName,
p.name as columnName
FROM sqlite_master m, pragma_table_info((m.name)) p
WHERE m.name <> p.name and p.name = 'GameID'
order by tableName, p.cid
;""", con)
con.close()
con = sqlite3.connect(dbfile)
cur = con.cursor()
total_rowcount = 0
for table in gametables["tableName"]:
cur.execute(f"DELETE FROM {table} WHERE {table}.GameID <> Your Game ID here")
total_rowcount += cur.rowcount
print(cur.rowcount)
con.commit()
print("Total", total_rowcount, "Records updated successfully")
cur.close()
con.close()
Find your gameID by making sure you ran some eventful turns of your desired game, and using the browser above or running a query to find the last item in your FCT_GameLog table and its gameID