prevent sql data case where group_by is none but keys is not empty
use custom exception
Merge pull request #639 from dimagi/sqlg

prevent sql data use case where group_by is none but keys is not empty