Use the static SQL class rather than instantiating a model
Integrated changes from upstream 1.7