run yapf
parent
8b90c5ff01
commit
14f9291836
|
@ -46,6 +46,7 @@ def main():
|
|||
data = yaml.full_load(yl)
|
||||
do_damage(data, conn)
|
||||
|
||||
|
||||
def do_damage(data, conn):
|
||||
# make the four tables
|
||||
do_damage_sub_tables(data, conn)
|
||||
|
@ -106,6 +107,7 @@ INSERT INTO damagetype(name, abbr, damagecategory_id)
|
|||
# now link the source entries to the damage types
|
||||
link_sourceentry_damagetype(i['name'], srcentrydata, conn)
|
||||
|
||||
|
||||
def link_sourceentry_damagecategory(name, srcentrydata, conn):
|
||||
stmt = """
|
||||
INSERT INTO sourceentry_damagecategory (sourceentry_id, damagecategory_id)
|
||||
|
@ -129,6 +131,7 @@ INSERT INTO sourceentry_damagecategory (sourceentry_id, damagecategory_id)
|
|||
conn.commit()
|
||||
pass
|
||||
|
||||
|
||||
def link_sourceentry_damagetype(name, srcentrydata, conn):
|
||||
stmt = """
|
||||
INSERT INTO sourceentry_damagetype (sourceentry_id, damagetype_id)
|
||||
|
@ -152,6 +155,7 @@ INSERT INTO sourceentry_damagetype (sourceentry_id, damagetype_id)
|
|||
conn.commit()
|
||||
pass
|
||||
|
||||
|
||||
def util_insert_into_sourceentry(data, conn):
|
||||
# print("srcentrydata: {}".format(data))
|
||||
stmt = "INSERT INTO sourceentry (source_id, page_start, page_stop) VALUES ((SELECT source_id FROM source WHERE abbr=?),?,?)"
|
||||
|
@ -172,6 +176,7 @@ def util_insert_into_sourceentry(data, conn):
|
|||
else:
|
||||
conn.commit()
|
||||
|
||||
|
||||
def do_damage_sub_tables(data, conn):
|
||||
table = """
|
||||
CREATE TABLE damagecategory (
|
||||
|
|
Loading…
Reference in New Issue