Perform *COUNT* aggregated query asynchronously.

    :return: number of objects in ``select()`` query
334863
async def count(query, clear_limit=False):
    
    clone = query.clone()
    if query._distinct or query._group_by or query._limit or query._offset:
        if clear_limit:
            clone._limit = clone._offset = None
        sql, params = clone.sql()
        wrapped = 'SELECT COUNT(1) FROM (%s) AS wrapped_select' % sql
        raw = query.model.raw(wrapped, *params)
        return (await scalar(raw)) or 0
    else:
        clone._returning = [peewee.fn.Count(peewee.SQL('*'))]
        clone._order_by = None
        return (await scalar(clone)) or 0
938416
def sparql_count(self, query, flush=None):
        
        return self.count_statements(query, language='sparql', type='tuples',
            flush=flush)
1263489
async def count(self, query, clear_limit=False):
        
        query = self._swap_database(query)
        return (await count(query, clear_limit=clear_limit))
13410
def count(self, view, include=None):
        
        return self._get(self._build_url(self.endpoint.count(id=view, include=include)))
563270
def count(cls, slug):
        
        from .models import Content
        # Gets the count for a tag, hopefully form an in-memory cache.
        cnt = cls._cache.get(slug)
        if cnt is None:
            cnt = Content.search_objects.search(tags=[slug]).count()
            cls._cache[slug] = cnt
        return cnt
952963
def count(self, model, context):
        
        SELECT_COUNT = self.statement('SELECT COUNT')

        try:
            sql, data = SELECT_COUNT(model, context)
        except orb.errors.QueryIsNull:
            return 0
        else:
            if context.dryRun:
                print sql % data
                return 0
            else:
                try:
                    rows, _ = self.execute(sql, data)
                except orb.errors.EmptyCommand:
                    rows = []

                return sum([row['count'] for row in rows])
1270558
def count(self):
        """"""
        if self.request["Select"] == "COUNT":
            while not self.exhausted:
                next(self, None)
        return self._count
521176
def getTableCount(verbose=None):
        

        response=api(url=self.url+'tables/count', method="GET", verbose=verbose, parse_params=False)
        return response
310649
def _count_model(self, model):
        
        try:
            res = model.objects.all().count()
        except Exception as e:
            self.err(e)
            return
        return res
789033
def count(self, cls, filters, quick=True, sort_by=None, select=None):
        
        query = "select count(*) from `%s` %s" % (self.domain.name, self._build_filter_part(cls, filters, sort_by, select))
        count = 0
        for row in self.domain.select(query):
            count += int(row['Count'])
            if quick:
                return count
        return count
864684
def count(self):
        
        if hasattr(self, '_response'):
            return self._response.hits.total

        es = connections.get_connection(self._using)

        d = self.to_dict(count=True)
        # TODO: failed shards detection
        return es.count(
            index=self._index,
            body=d,
            **self._params
        )['count']
932180
async def select(query):
    
    assert isinstance(query, peewee.SelectQuery),\
        ("Error, trying to run select coroutine"
         "with wrong query class %s" % str(query))

    cursor = await _execute_query_async(query)

    result = AsyncQueryWrapper(cursor=cursor, query=query)

    try:
        while True:
            await result.fetchone()
    except GeneratorExit:
        pass
    finally:
        await cursor.release()

    return result
474016
def results(self):
    
    self.wait()
    if self.failed:
      raise Exception('Query failed: %s' % str(self.errors))
    return self._table
61230
function count(req, res, next) {
  db.posts.count(function(err, count) {
    if(err) { return next(err); }
    res.json({count: count});
  });
}
1090651
def namedb_select_count_rows( cur, query, args, count_column='COUNT(*)' ):
    
    count_rows = namedb_query_execute( cur, query, args )
    count = 0
    for r in count_rows:
        count = r[count_column]
        break

    return count
832080
def get_count(self, query=None):
        
        query = query or Query()
        return self.get_db().alerts.find(query.where).count()
1027332
def get_relation_count_query(self, query, parent):
        
        if parent.get_query().from__ == query.get_query().from__:
            return self.get_relation_count_query_for_self_join(query, parent)

        self._set_join(query)

        return super(BelongsToMany, self).get_relation_count_query(query, parent)