get data from db and save locally and shoe in csv