having
Having clause for filtering grouped queries.
Having
dataclass
Represents a HAVING clause for filtering aggregated/grouped results.
HAVING clauses are similar to WHERE clauses but operate on grouped/aggregated data. They are typically used with GROUP BY to filter groups based on aggregate conditions.
from embar.query.having import Having
from embar.query.where import Gt
from embar.column.base import ColumnBase, ColumnInfo
# Example: HAVING COUNT(*) > 5
count_col = ColumnBase()
count_col.info = ColumnInfo(
_table_name=lambda: "users",
name="count",
col_type="INTEGER",
py_type=int,
primary=False,
not_null=False
)
having = Having(Gt(count_col, 5))
Source code in src/embar/query/having.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | |