# - - - c o p y C i r def copyCir(my, db, cir): '''Copy the data for one circle. [ (my is a MyCBC instance) and (db is a CBCData instance) and (cir is a MyCBC.Cir instance) -> db := db + (all data for cir) ] '''
To preserve all the data for one circle in the old database,
we need to add rows to up to five tables:
efforts. The first three are built in Section 9.6, “
#-- 1 -- # [ db.s +:= a circle row and related cir_reg and cir_physio # rows added, made from cir ] t0 = Timer('Adding circle %s' % cir.lat_lon) addCircle(my, db, cir)
That takes care of all the one-per-circle items. Items
related to circle-years are processed in Section 9.7, “
#-- 2 -- # [ db.s +:= all circle-year data from db for cir ] for stnd in my.genStnds(cir.lat_lon): addCircleYear(my, db, stnd)
So far all those added rows are in the session,
db.s; now commit them.
#-- 3 -- # [ db := db with transactions in db.s committed ] db.s.commit() print t0 sys.stdout.flush()