script writes to sqlite db