sql writer api cleanup