put skip_write check in sql