script for exporting db to csv