code: function SqlSelect (model, args) {
      // capture input
      this.model = model
      this.args = _.cloneDeep(args)
      // make sure where is defined in args
      this.args.where = requireValidOptionalObject(this.args.where)
  
      // map of alias => table
      this.aliases = {}
      // map of table => alias - since the same table can be used multiple times
      // in query the canonical alias for a table is the one that data is being
      // selected from 
      this.tableAliases = {}
  
      // primary table name
      this.table = model.name
      // primary table alias
      this.alias = this.getAlias(this.table)
  
      // list of related model names joined on
      this.joinRelationNames = []
      // map of related models joined on with join config
      this.joinRelations = {}
  
      // list of columns to select
      this.select = []
      // list of join statements
      this.join = []
      // list of where statements
      this.where = []
      // list of order statements
      this.order = []
      // limit for query
      this.limit = undefined
      // offset for query
      this.offset = undefined
  
      // params for query placeholder => value
      this.params = {}
  
      // check if query is select by id
      this.checkSelectById()
      // check if query should select only ids
      this.checkSelectOnlyIds()
  
      // execute simple selectById if this is an id query with no extra flags
      if (this.isSelectById) {
          this.selectById()
      }
      // execute generic query builder
      else {
          // add access control checks
          this.addAccessControl()
          // build joins on relations
          this.buildJoinRelations()
          // build list of columns from the primary table to select
          this.buildSelect()
          // get the queried revision(s) of objects
          this.buildRevision()
          // build where args
          _.each(this.args.where, (value, name) => this.buildWhere(name, value))
          // build order args
          this.buildOrder()
          // build full sql SELECT statement
          this.buildSql()
      }
  }
docs: @function SqlSelect
  
  create new sql select query builder instance
  
  @param {ImmutableCoreModel} model
  @param {object} args
  
  @returns {SqlSelect}