def getrefs(self): #get data from the database into a list self.cur.execute("""SELECT sales_rep_id,sales_rep_territory,daily_gallon_plan from sales_rep""") self.sales_rows = self.cur.fetchall() for sr in self.sales_rows: self.reps[sr[0]] = {'TerritoryId':sr[1], 'Plan':sr[2]} self.cur.execute("""SELECT product_id,gallons from product""") self.prod_rows = self.cur.fetchall() for p in self.prod_rows: self.prods[p[0]] = {'Gallons': p[1]} self.cur.execute( """ SELECT territory_id,territory_name, SUM(daily_gallon_plan) plan from territory t, sales_rep r WHERE r.sales_rep_territory = t.territory_id GROUP BY t.territory_id, t.territory_name """ ) self.terr_rows = self.cur.fetchall() for t in self.terr_rows: self.sales[t[0]] = {'Name':t[1], 'Plan':t[2], 'Act':0.0, 'Ave':0.0, 'Stat':0, 'Tstamp':''} self.cur.close() self.conn.close()