got size working

source_entries
James Miller 2019-11-11 16:43:38 -06:00
parent c8bde8dad6
commit 80a11b3b10
2 changed files with 33 additions and 6 deletions

View File

@ -22,8 +22,35 @@ def main():
do_frequency(data['frequency'], conn)
do_langrarity(data['lang_rarity'], conn)
do_movement(data['movement'], conn)
do_size(data['size'], conn)
do_weaponcategory(data['weaponcategory'], conn)
def do_size(data, conn):
table = """
CREATE TABLE size (
size_id INTEGER PRIMARY KEY,
short_name TEXT NOT NULL UNIQUE,
space_in_ft INTEGER NOT NULL,
reach_tall_ft INTEGER NOT NULL,
reach_long_ft INTEGER NOT NULL
);
"""
c = conn.cursor()
c.execute(table)
inp_data = []
for i in data:
inp_data.append((i['name'], i['space_in_ft'], i['reach_tall_ft'], i['reach_long_ft']))
stmt = "INSERT INTO size (short_name, space_in_ft, reach_tall_ft, reach_long_ft) VALUES (?,?,?,?)"
try:
conn.executemany(stmt,inp_data)
except:
print("Error creating size")
else:
conn.commit()
def do_weaponcategory(data, conn):
table = """
CREATE TABLE weaponcategory (

View File

@ -77,27 +77,27 @@ size:
- name: Tiny
space_in_ft: 4
reach_tall_ft: 0
reach_long_Ft: 0
reach_long_ft: 0
- name: Small
space_in_ft: 5
reach_tall_ft: 5
reach_long_Ft: 5
reach_long_ft: 5
- name: Medium
space_in_ft: 5
reach_tall_ft: 5
reach_long_Ft: 5
reach_long_ft: 5
- name: Large
space_in_ft: 10
reach_tall_ft: 10
reach_long_Ft: 5
reach_long_ft: 5
- name: Huge
space_in_ft: 15
reach_tall_ft: 15
reach_long_Ft: 10
reach_long_ft: 10
- name: Gargantuan
space_in_ft: 20
reach_tall_ft: 20
reach_long_Ft: 15
reach_long_ft: 15
weaponcategory:
- Unarmed
- Simple