got weaponcategory working

source_entries
James Miller 2019-11-11 16:39:50 -06:00
parent c03d61536c
commit c8bde8dad6
2 changed files with 27 additions and 1 deletions

View File

@ -22,6 +22,32 @@ def main():
do_frequency(data['frequency'], conn)
do_langrarity(data['lang_rarity'], 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):
table = """

View File

@ -98,7 +98,7 @@ size:
space_in_ft: 20
reach_tall_ft: 20
reach_long_Ft: 15
weapon_category:
weaponcategory:
- Unarmed
- Simple
- Martial