Fix problem with out of memory

When using 32-but python, would get an out-of-memory error. Changed code
to it would read one line at a time from the file rather than all at
once.
Fix: subclass foreign key getting truncated