Skip to content

Queries

Inform about the data source that is used, query statements, and order.

All queries follow BaseQuery model.

class BaseQuery(BaseModel, abc.ABC):
    from_: From
    where: Optional[WhereExpression]
    order_by: Optional[List[data.OrderByAttribute]]
    limit: int = Field(None, gt=0)
    offset: int = Field(None, ge=0)

Select Query

Fetches simple data.

class SelectQuery(BaseQuery):
    attributes: List[Union[data.ProjectionAttribute, data.StaticValueAttribute]]
    distinct: bool = False

Aggregation Query

Fetches aggregated data.

class AggregationQuery(BaseQuery):
    aggregations: List[Union[data.AggregationAttribute, data.StaticValueAttribute]]

GroupBy Query

Fetches grouped data.

class GroupByQuery(BaseQuery):
    aggregations: List[Union[data.AggregationAttribute, data.StaticValueAttribute]]
    groups: List[data.BinningAttribute],
    bin_interpolation: Optional[bool] = True

Info

bin_interpolation flag tells whether the result of the query should contain all the bins resulting from the combinations of the attributes used in groups parameter, including the empty ones. Bin interpolation utils provides an helper for such cases. The default_bin_interpolation value specified in the aggregations attributes will be used for the empty bins (None value will be used if not specified).

Query

All used types of queries.

Query = Union[GroupByQuery, AggregationQuery, SelectQuery]

Last update: April 7, 2021