Returns a select clause based on the given filter args
546428
def _select_query(self):
        
        if self._where:
            self._validate_select_where()
        return SelectStatement(
            self.column_family_name,
            fields=self._select_fields(),
            where=self._where,
            order_by=self._order,
            limit=self._limit,
            allow_filtering=self._allow_filtering
        )
1193690
def query(
            self,
            select_column_names,
            filter_column,
            filter_value,
            feature,
            distinct=False,
            required=False):
        
        sql = """
            SELECT %s%s
            FROM %s
            WHERE %s = ?
        """ % ("distinct " if distinct else "",
               ", ".join(select_column_names),
               feature,
               filter_column)
        query_params = [filter_value]
        return self.run_sql_query(
            sql, required=required, query_params=query_params)
166024
def select(self, to_select, where=None, sql_params=None):
        '''
        
        '''
        if sql_params is None:
            sql_params = []
        query = '''
        SELECT %s FROM %s
        ''' % (to_select, self._name)
        if where:
            query = '%s WHERE %s' % (query, where)
        return self._cursor.execute(query, tuple(sql_params))
856483
def filter(self, *args):
    '''

    '''
    if len(args) == 1 and isinstance(args[0], Filter):
      filter = args[0]
    else:
      filter = Filter(*args)

    # ensure filter gets attr values the same way the rest of the query does.
    filter.object_getattr = self.object_getattr
    self.filters.append(filter)
    return self
243554
def query_property_filter(query, options)
      if options[:where]
        opts = options[:where]
        if opts[0].is_a?(Array)
          opts.each do |opt|
            query.where(opt[0], opt[1], opt[2]) unless opt.nil?
          end
        else
          query.where(opts[0], opts[1], opts[2])
        end
      end
      query
    end
1030499
def filterBy(self, **kwargs):
        ''' '''
        criteria = ['seeds', 'size']
        for k, v in kwargs.iteritems():
            if k in criteria:
                self.results = filter(
                    lambda x: getattr(x, k) >= v, self.results)
        return self
783022
def get_filter_rule(self, _filter, way='in'):
        
        if isinstance(_filter, zobjects.FilterRule):
            _filter = _filter.name
        for f in self.get_filter_rules(way=way):
            if f.name == _filter:
                return f
        return None
1185525
function argumentFilter(args){
		var ret;
		if (typeof args[0] == 'object') {
			args=args[0];
			ret={};
			for (var i in args) if (args.hasOwnProperty(i) && typeof args[i] == 'function') {
				ret[i]=args[i];
			}
			return ret;
		}
		ret=[];
		for (var i=0,ii=args.length;i<ii;i++) if (typeof args[i] == 'function') {
			ret.push(args[i]);
		}
		return ret;
	}
497550
def select(self, table, items=None, limit=None, offset=None, remote_filter=None, func_filters=None):
        '''
        '''
        self._table = table

        if remote_filter:
            if not isinstance(remote_filter, tuple):
                raise TypeError("{0} must be of type <type tuple>".format(remote_filter))

            table = "%s(%s)" %(table, ','.join(map(str, remote_filter)))

        if not items:
            items = ['*']
        self._query = "SELECT {1} FROM {0} ".format(table, ','.join(items))

        if func_filters:
            self._func = self._func_filters(func_filters) 

        self._limit = limit
        self._offset = offset
            
        return self
595662
def grep(pattern, &block)
      result = select { |item| pattern === item }
      result = result.map(&block) if block_given?
      return result
    end
979005
def selectSQL(conn, sql, args=None):
    '''
    
    '''
    with doCursor(conn) as cursor:
        cursor.execute(sql, args)
        results = cursor.fetchall()
        return results
56539
def filter(self):
        
        if isinstance(self._filter, str):
            return self._decode_query(self._filter)
        return self._filter
1040085
def choose(cls, choices, field="Id", qb=None):
        
        return cls.where(build_choose_clause(choices, field), qb=qb)
267231
function select($fields,$filter=NULL,array $options=NULL,$ttl=0) {
		list($sql,$args)=$this->stringify($fields,$filter,$options);
		$result=$this->db->exec($sql,$args,$ttl);
		$out=[];
		foreach ($result as &$row) {
			foreach ($row as $field=>&$val) {
				if (array_key_exists($field,$this->fields)) {
					if (!is_null($val) || !$this->fields[$field]['nullable'])
						$val=$this->db->value(
							$this->fields[$field]['pdo_type'],$val);
				}
				unset($val);
			}
			$out[]=$this->factory($row);
			unset($row);
		}
		return $out;
	}
950759
function filter(fp, opts) {
  if (opts && opts.filter) {
    return opts.filter(fp, opts);
  }
  return /[^x]\.js$/.test(fp);
}
138920
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()
    }
}
612072
def find_one_sql(table, filter, fields=None):
    '''
    
    '''
    keys, values = _split_dict(filter)
    fields = ', '.join(fields) if fields else '*'
    where = _pairs(keys)
    sql = 'SELECT {} FROM {} WHERE {}'.format(fields, table, where)
    return sql, values