Next / Previous / Contents / NM Tech homepage

9.4. transloader: dbCopy()

transloader
# - - -   d b C o p y

def dbCopy(my, db):
    '''Copy all the MySQL data to Postgresql.

      [ (my is a MyCBC instance) and
        (db is a CBCData instance) ->
          db  :=  db with all data added from my ]
    '''

This process is driven by the old cir file. For each circle, we add a new row to the circles table. Then, for each region, we'll add a cir_reg row relating the circle and region, and for each physiographic stratum code, add a cir_physio row relating the circle and physiographic region.

There is one additional wrinkle: the original cir table has a dummy entry for lat-long “000000000”, which should not be propagated to the new database.

transloader
    cirCount = 0
    for cir in my.genCirs():
        cirCount += 1
        if cir.lat_lon != '000000000':
            copyCir(my, db, cir)