Functions for aggregation in group_by.
avg(mdp, cast_type=<class 'float'>)
Aggregate function to make a AVG.
Source code in py_linq_sql/build_request/consult_aggregate.py
def avg(mdp: MagicDotPath, cast_type: type = float) -> MagicDotPathAggregate:
"""
Aggregate function to make a AVG.
Args:
mdp: A MagicDotPath to give the path of the function.
cast_type: Type in which we want to cast the path(s). Its optional.
By default: float
Returns:
MagicDotPathAggregate with the mdp and the type of aggregation.
"""
return MagicDotPathAggregate(mdp, AggregateType.AVG, cast_type)
concat(mdp, separator)
Aggregate function to make a CONCAT.
Source code in py_linq_sql/build_request/consult_aggregate.py
def concat(
mdp: MagicDotPath,
separator: str,
) -> MagicDotPathAggregate:
"""
Aggregate function to make a CONCAT.
Args:
mdp: A MagicDotPath to give the path of the function.
Returns:
MagicDotPathAggregate with the mdp, the type of aggregation and the separator.
"""
return MagicDotPathAggregate(
mdp,
AggregateType.CONCAT,
separator=separator,
cast_type=str,
)
count(mdp, cast_type=<class 'float'>)
Aggregate function to make a COUNT.
Source code in py_linq_sql/build_request/consult_aggregate.py
def count(mdp: MagicDotPath, cast_type: type = float) -> MagicDotPathAggregate:
"""
Aggregate function to make a COUNT.
Args:
- mdp: A MagicDotPath to give the path of the function.
- cast_type: Type in which we want to cast the path(s). Its optional.
By default: float
Returns:
MagicDotPathAggregate with the mdp and the type of aggregation.
"""
return MagicDotPathAggregate(mdp, AggregateType.COUNT, cast_type)
max(mdp, cast_type=<class 'float'>)
Aggregate function to make a MAX.
Source code in py_linq_sql/build_request/consult_aggregate.py
def max( # noqa: A001
mdp: MagicDotPath,
cast_type: type = float,
) -> MagicDotPathAggregate:
"""
Aggregate function to make a MAX.
Args:
mdp: A MagicDotPath to give the path of the function.
cast_type: Type in which we want to cast the path(s). Its optional.
By default: float
Returns:
MagicDotPathAggregate with the mdp and the type of aggregation.
"""
return MagicDotPathAggregate(mdp, AggregateType.MAX, cast_type)
min(mdp, cast_type=<class 'float'>)
Aggregate function to make a MIN.
Source code in py_linq_sql/build_request/consult_aggregate.py
def min( # noqa: A001
mdp: MagicDotPath,
cast_type: type = float,
) -> MagicDotPathAggregate:
"""
Aggregate function to make a MIN.
Args:
mdp: A MagicDotPath to give the path of the function.
cast_type: Type in which we want to cast the path(s). Its optional.
By default: float
Returns:
MagicDotPathAggregate with the mdp and the type of aggregation.
"""
return MagicDotPathAggregate(mdp, AggregateType.MIN, cast_type)
sum(mdp, cast_type=<class 'float'>)
Aggregate function to make a SUM.
Source code in py_linq_sql/build_request/consult_aggregate.py
def sum( # noqa: A001
mdp: MagicDotPath,
cast_type: type = float,
) -> MagicDotPathAggregate:
"""
Aggregate function to make a SUM.
Args:
mdp: A MagicDotPath to give the path of the function.
cast_type: Type in which we want to cast the path(s). Its optional.
By default: float
Returns:
MagicDotPathAggregate with the mdp and the type of aggregation.
"""
return MagicDotPathAggregate(mdp, AggregateType.SUM, cast_type)