created and integrated write_to_sqlite

- needs more testing