fix FK issues which caught a data error in spells.py
parent
6559b31024
commit
4d9b604bf2
|
@ -155,14 +155,15 @@ def do_spell_components(i,id,conn,ctypes):
|
||||||
if k.capitalize() == j[1]:
|
if k.capitalize() == j[1]:
|
||||||
res = j[0]
|
res = j[0]
|
||||||
|
|
||||||
inp = (res, id)
|
inp = (id, res)
|
||||||
|
|
||||||
stmt = "INSERT INTO spells_spellcomponents (spells_id, spellcomponents_id) VALUES (?,?)"
|
stmt = "INSERT INTO spells_spellcomponents (spells_id, spellcomponents_id) VALUES (?,?)"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
conn.execute(stmt, inp)
|
conn.execute(stmt, inp)
|
||||||
except:
|
except sqlite3.Error as e:
|
||||||
print("Error inserting spell components")
|
print("Error inserting spell components: {}".format(e))
|
||||||
|
print("\tinp: {}".format(inp))
|
||||||
else:
|
else:
|
||||||
conn.commit()
|
conn.commit()
|
||||||
|
|
||||||
|
@ -224,7 +225,7 @@ def do_spell_traits(i, id, conn, traits):
|
||||||
# print(inp)
|
# print(inp)
|
||||||
|
|
||||||
# insert into sql
|
# insert into sql
|
||||||
stmt = "INSERT OR REPLACE INTO spells_traits (spells_id, traits_id) VALUES (?,?)"
|
stmt = "INSERT OR REPLACE INTO spells_traits (spells_id, trait_id) VALUES (?,?)"
|
||||||
try:
|
try:
|
||||||
conn.executemany(stmt, inp)
|
conn.executemany(stmt, inp)
|
||||||
except:
|
except:
|
||||||
|
|
6
gendb.sh
6
gendb.sh
|
@ -62,9 +62,9 @@ sqlite3 pf2.db < data/gear.sql
|
||||||
echo '15'
|
echo '15'
|
||||||
sqlite3 pf2.db < data/heritages.sql
|
sqlite3 pf2.db < data/heritages.sql
|
||||||
# Comment out the following three lines if you don't want to generate the spell data.
|
# Comment out the following three lines if you don't want to generate the spell data.
|
||||||
# cd data/third_party_json
|
cd data/third_party_json
|
||||||
# python3 spells.py
|
python3 spells.py
|
||||||
# cd ../..
|
cd ../..
|
||||||
|
|
||||||
# TODO Eventually we will stop relying on the spells.py script and I will have
|
# TODO Eventually we will stop relying on the spells.py script and I will have
|
||||||
# the actual .sql files for the spell data; I am waiting to see if the
|
# the actual .sql files for the spell data; I am waiting to see if the
|
||||||
|
|
Loading…
Reference in New Issue