externalize getSQL method