Refactor SQL builder
Merge branch 'release-1.2.0'