got weaponcategory working
parent
c03d61536c
commit
c8bde8dad6
|
@ -22,6 +22,32 @@ def main():
|
||||||
do_frequency(data['frequency'], conn)
|
do_frequency(data['frequency'], conn)
|
||||||
do_langrarity(data['lang_rarity'], conn)
|
do_langrarity(data['lang_rarity'], conn)
|
||||||
do_movement(data['movement'], conn)
|
do_movement(data['movement'], conn)
|
||||||
|
do_weaponcategory(data['weaponcategory'], conn)
|
||||||
|
|
||||||
|
def do_weaponcategory(data, conn):
|
||||||
|
table = """
|
||||||
|
CREATE TABLE weaponcategory (
|
||||||
|
weaponcategory_id INTEGER PRIMARY KEY,
|
||||||
|
"name" TEXT NOT NULL UNIQUE
|
||||||
|
);
|
||||||
|
"""
|
||||||
|
|
||||||
|
c = conn.cursor()
|
||||||
|
c.execute(table)
|
||||||
|
|
||||||
|
inp_data = []
|
||||||
|
for i in data:
|
||||||
|
inp_data.append((i,)) # trailing comma necessary for one-item tuple
|
||||||
|
|
||||||
|
stmt = "INSERT INTO weaponcategory(name) VALUES (?)"
|
||||||
|
try:
|
||||||
|
conn.executemany(stmt,inp_data)
|
||||||
|
except:
|
||||||
|
e = sys.exc_info()[0]
|
||||||
|
print("Error creating weaponcategory: {}".format(e))
|
||||||
|
print(vars(e))
|
||||||
|
else:
|
||||||
|
conn.commit()
|
||||||
|
|
||||||
def do_movement(data, conn):
|
def do_movement(data, conn):
|
||||||
table = """
|
table = """
|
||||||
|
|
|
@ -98,7 +98,7 @@ size:
|
||||||
space_in_ft: 20
|
space_in_ft: 20
|
||||||
reach_tall_ft: 20
|
reach_tall_ft: 20
|
||||||
reach_long_Ft: 15
|
reach_long_Ft: 15
|
||||||
weapon_category:
|
weaponcategory:
|
||||||
- Unarmed
|
- Unarmed
|
||||||
- Simple
|
- Simple
|
||||||
- Martial
|
- Martial
|
||||||
|
|
Loading…
Reference in New Issue