Throw error if no sql query is set