properly generates an sql database, but slow as balls