From http://stackoverflow.com/questions/13356041/best-way-to-dump-one-database-table-with-limit-and-all-association