load-zipcodes
These python scripts use the python module uszipcode (documentation) to populate a postgresql database table. As I was writing another app, I found it more useful to have all the zipcodes loaded into a database instead of running uszipcode inline. So I decided to write this little script to get the job done. It only does inserts at this time. Once uszipcode updates, I'll update this script to add logic to upsert.
At the time of this posting, it is up-to-date as of October, 2015 (which corresponds to uszipcode v0.0.7). I have also posted the SQL files which will be much easier for you, but if uszipcode has updated with newer data, you will want to run the script instead.
Feel free to branch this to add support of other databases.
Requires uszipcode, psycopg2, pprint, sys
<a href"https://github.com/rubix1138/load-zipcodes/blob/master/loadZips.py">loadZips.py is the base file.
<a href"https://github.com/rubix1138/load-zipcodes/blob/master/loadZips2.py">loadZips2.py is file I actually used because I wanted to link the states to my state table. I used StateTable.com to build my state table.
<a href"https://github.com/rubix1138/load-zipcodes/blob/master/loadZips2.py">zipCodeTable.sql is a pgdump file of the resulting zipcod table.