def rebuild(): """ Build the datastore/database by fetching the category data from ebay """ # fetch data and extract from xml category_data_xml = fetch_categories_from_ebay() category_data = extract_category_data(category_data_xml) # connect to database datastore = DataStore() datastore.connect() # create a new table. drop first if exists datastore.drop_table() datastore.create_table() # insert data into datastore datastore.insert_all(category_data) # close connection datastore.disconnect()