Skip to content

Commit

Permalink
debug annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
kfsone committed Aug 25, 2014
1 parent 9f3b1ef commit 2700bd6
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions dbimport.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ def main():
station = Station(newStationID, system, stationName)
stations[stationName] = station
stationByOldID[oldStationID] = newStationID
debug_log(1, "{} stations loaded".format(len(stations)))

with check_item("Populate `Ship` table"):
global maxJumpDistanceLy
Expand All @@ -140,7 +141,10 @@ def main():
] ]
maxJumpDistanceLy = max(maxJumpDistanceLy, ship.maxJump, ship.maxJumpFull)
outCur.executemany(stmt, rows)
debug_log(1, "{} ships loaded".format(len(dataseed.ships.ships)))
debug_log(1, "Maximum distance any ship jumps: {:.2f}ly".format(maxJumpDistanceLy))

shipLocations = 0
with check_item("Populate `ShipVendor` table"):
stmt = """
INSERT INTO ShipVendor
Expand All @@ -156,6 +160,8 @@ def main():
ship.name, station.ID, 0 # We don't have prices yet.
] ]
outCur.executemany(stmt, rows)
shipLocations = len(rows)
debug_log(1, "{} ship locations loaded".format(shipLocations))

with check_item("Populate `Upgrade` table") as check:
# TODO: Populate Upgrade
Expand All @@ -177,6 +183,7 @@ def main():
categories[TradeDB.normalized_str(categoryName)] = categoryID
categoryByOldID[ID] = categoryID
outCur.executemany(stmt, rows)
debug_log(1, "{} item categories loaded".format(len(categories)))

with check_item("Populate `Item` table") as check:
inCur.execute("SELECT ID, category_id, item FROM Items")
Expand All @@ -189,6 +196,8 @@ def main():
items[TradeDB.normalized_str(itemName)] = itemID
itemByOldID[ID] = itemID
outCur.executemany(stmt, rows)
debug_log(1, "{} items loaded".format(len(items)))


outConn.commit()

Expand Down

0 comments on commit 2700bd6

Please sign in to comment.