outcsv = csv.writer(outfile)
cursor = con.execute('select * from mytable')
outcsv.writerow(x[0] for x in cursor.description)
outcsv.writerows(cursor.fetchall())
outfile.close()
dump csv from sqlalchemy