Sort:  

It really wasn't all that hard to search it out. Most of the code is in my previous post which I linked to near the beginning.

Honestly, the worst part was getting the graphviz settings just right so that it didn't blow up in the middle of some of the larger data manipulations. The actual underlying code dealing with database stuff is all pretty brute force. Nothing with a lot of finesse going on there.