@_generative(_no_statement_condition, _no_limit_offset)
def having(self, criterion):
    'apply a HAVING criterion to the query and return the\n        newly resulting :class:`.Query`.\n\n        :meth:`~.Query.having` is used in conjunction with\n        :meth:`~.Query.group_by`.\n\n        HAVING criterion makes it possible to use filters on aggregate\n        functions like COUNT, SUM, AVG, MAX, and MIN, eg.::\n\n            q = session.query(User.id).\\\n                        join(User.addresses).\\\n                        group_by(User.id).\\\n                        having(func.count(Address.id) > 2)\n\n        '
    criterion = expression._expression_literal_as_text(criterion)
    if ((criterion is not None) and (not isinstance(criterion, sql.ClauseElement))):
        raise sa_exc.ArgumentError('having() argument must be of type sqlalchemy.sql.ClauseElement or string')
    criterion = self._adapt_clause(criterion, True, True)
    if (self._having is not None):
        self._having = (self._having & criterion)
    else:
        self._having = criterion
apply a HAVING criterion to the query and return the
newly resulting :class:`.Query`.

:meth:`~.Query.having` is used in conjunction with
:meth:`~.Query.group_by`.

HAVING criterion makes it possible to use filters on aggregate
functions like COUNT, SUM, AVG, MAX, and MIN, eg.::

    q = session.query(User.id).\
                join(User.addresses).\
                group_by(User.id).\
                having(func.count(Address.id) > 2)
@_generative(_no_statement_condition, _no_limit_offset)
def having(self, criterion):
    'apply a HAVING criterion to the query and return the\n        newly resulting :class:`.Query`.\n\n        :meth:`~.Query.having` is used in conjunction with\n        :meth:`~.Query.group_by`.\n\n        HAVING criterion makes it possible to use filters on aggregate\n        functions like COUNT, SUM, AVG, MAX, and MIN, eg.::\n\n            q = session.query(User.id).\\\n                        join(User.addresses).\\\n                        group_by(User.id).\\\n                        having(func.count(Address.id) > 2)\n\n        '
    criterion = expression._expression_literal_as_text(criterion)
    if ((criterion is not None) and (not isinstance(criterion, sql.ClauseElement))):
        raise sa_exc.ArgumentError('having() argument must be of type sqlalchemy.sql.ClauseElement or string')
    criterion = self._adapt_clause(criterion, True, True)
    if (self._having is not None):
        self._having = (self._having & criterion)
    else:
        self._having = criterion