Connection to the SQL server is lost during data import
When using a version of the psycopg2 library prior to 2.2, the connection to the SQL server resets when larger amount of data is copied and SSL is ative. There are two solutions to this problem.
1/ Disable SSL
When SSL is switched off for client-server communication, this problem seems to disappear. To turn SSL off, just put:
ssl = false
NOTE: Because of the security implications of turning off SSL, this is advisable only when local database is used.
2/ Upgrade psycopg2
Update to psycopg2 version 2.2 and higher takes care of this problem. If there are no packages on your server for this version, you can install from sources.
For example on Ubuntu 10.04 which we use as testing server, only version 2.0.13 is available. To install from sources, you can just use the following few commands:
sudo aptitude remove python-psycopg2 sudo aptitude install python-setuptools libpq-dev python-dev sudo easy_install psycopg2
After this, there should be the newest available version of psycopg2 installed on your system and the problem should be solved.
NOTE: Make sure to re-run python create_tables.py before retrying the import.