cosmos to sqlite

why are there two loops?