Next / Previous / Contents / NM Tech homepage

9. transloader: Copy over the MySQL database

This script is run after staticloader (see Section 7, “The staticloader script: Populate the static tables”) to convert the MySQL database to the new form.

9.1. transloader: Prologue

transloader
#!/usr/bin/env python
# transloader: Copy MySQL CBC database to Posgresql
#   For documentation, see:
#       http://www.nmt.edu/~shipman/z/cbc/pycbc/

Input is from the mycbc module: see Section 8.2, “mycbc.py: Interface to the 1998 database”. Output is to the pycbc module; see Section 5, “Using the pycbc interface”.

transloader
#================================================================
# Imports
#----------------------------------------------------------------
from timer import Timer
t0 = Timer('Imports')
import sys
import mycbc, pycbc
print t0

The passwords are kept in external files readable only by the author, so the actual passwords don't need to appear here.

transloader
#================================================================
# Manifest constants
#----------------------------------------------------------------
MY_PASS = "mypass"      # MySQL password file
PS_PASS = "pspass"      # Postgresql password file