fix sde import
This commit is contained in:
@@ -28,6 +28,8 @@ with open("static_eve/sde/fsd/categoryIDs.yaml", "r", encoding="utf-8") as f:
|
||||
|
||||
with Session(sde_engine) as db:
|
||||
for id, category in categories.items():
|
||||
if category["published"] == False:
|
||||
continue
|
||||
db.add(models_sde.Category(id=id,
|
||||
icon_id=category['iconID'] if 'iconID' in category else None,
|
||||
name=category['name']['en'],
|
||||
@@ -41,6 +43,8 @@ with open("static_eve/sde/fsd/groupIDs.yaml", "r", encoding="utf-8") as f:
|
||||
|
||||
with Session(sde_engine) as db:
|
||||
for id, group in groups.items():
|
||||
if group["published"] == False:
|
||||
continue
|
||||
db.add(models_sde.Group(id=id,
|
||||
anchorable=group['anchorable'],
|
||||
anchored=group['anchored'],
|
||||
@@ -76,21 +80,19 @@ with open("static_eve/sde/fsd/typeIDs.yaml", "r", encoding="utf-8") as f:
|
||||
|
||||
with Session(sde_engine) as db:
|
||||
for id, type in types.items():
|
||||
try:
|
||||
db.add(models_sde.Type(id=id,
|
||||
group_id=type['groupID'],
|
||||
marketgroup_id=type['marketGroupID'] if 'marketGroupID' in type else None,
|
||||
name=type['name']['en'],
|
||||
published=type['published'],
|
||||
basePrice=type['basePrice'] if 'basePrice' in type else None,
|
||||
description=type['description']['en'] if 'description' in type else None,
|
||||
icon_id=type['iconID'] if 'iconID' in type else None,
|
||||
portionSize=type['portionSize'],
|
||||
volume=type['volume'] if 'volume' in type else None,
|
||||
))
|
||||
except KeyError:
|
||||
print(type)
|
||||
raise
|
||||
if type["published"] == False:
|
||||
continue
|
||||
db.add(models_sde.Type(id=id,
|
||||
group_id=type['groupID'],
|
||||
marketgroup_id=type['marketGroupID'] if 'marketGroupID' in type else None,
|
||||
name=type['name']['en'],
|
||||
published=type['published'],
|
||||
basePrice=type['basePrice'] if 'basePrice' in type else None,
|
||||
description=type['description']['en'] if 'description' in type else None,
|
||||
icon_id=type['iconID'] if 'iconID' in type else None,
|
||||
portionSize=type['portionSize'],
|
||||
volume=type['volume'] if 'volume' in type else None,
|
||||
))
|
||||
db.commit()
|
||||
|
||||
|
||||
@@ -100,7 +102,7 @@ with open("static_eve/sde/fsd/typeMaterials.yaml", "r", encoding="utf-8") as f:
|
||||
|
||||
with Session(sde_engine) as db:
|
||||
for id, material in materials.items():
|
||||
for mat in material:
|
||||
for mat in material['materials']:
|
||||
db.add(models_sde.TypeMaterial(type_id=id,
|
||||
material_id=mat['materialTypeID'],
|
||||
quantity=mat['quantity']
|
||||
@@ -108,5 +110,4 @@ with Session(sde_engine) as db:
|
||||
db.commit()
|
||||
|
||||
|
||||
|
||||
print("DONE!")
|
||||
Reference in New Issue
Block a user