initial version of a SQL writer