Python and SQL changes that work for a full import

I'm testing it right now, so please wait on this.