added sqlite pragmas to speed up spells.py

merge-requests/33/merge
James R Miller 2019-08-14 17:55:06 -05:00
parent b1884f25b8
commit 5d578c5b79
1 changed files with 9 additions and 0 deletions

View File

@ -29,6 +29,15 @@ def main():
## Get database connection
conn = sqlite3.connect('../../pf2.db')
## Set pragmas
pragma1 = "PRAGMA synchronous=OFF;"
pragma2 = "PRAGMA count_changes=OFF;"
pragma3 = "PRAGMA journal_mode=MEMORY;"
pragma4 = "PRAGMA temp_store=MEMORY;"
conn.execute(pragma1)
conn.execute(pragma2)
conn.execute(pragma3)
conn.execute(pragma4)
# load in ids for traits from traits table so we only call this once
# instead of every spell