base
Module to interact with PQL queries.
This module contains class to interact with PQL queries including columns and filters.
Typical usage example
PQLColumn ¶
Bases: SaolaPyBaseModel
Class representing PQL column of OLAP table.
Attributes:
-
name
(
str
) –Name of the column.
-
query
(
str
) –PQL query of the column.
PQLFilter ¶
Bases: SaolaPyBaseModel
Class representing PQL filter.
Attributes:
-
query
(
str
) –Query of PQL filter. Needs to have format 'FILTER CONDITION;'.
OrderByColumn ¶
Bases: SaolaPyBaseModel
Class representing order by column used to order results of query.
Attributes:
-
query
(
str
) –Query of order by column.
-
ascending
(
bool
) –Whether results should be sorted ascending or descending. Default True.
PQL ¶
Bases: SaolaPyBaseModel
Class representing PQL query that can be used for data export.
Attributes:
-
columns
(
List[PQLColumn]
) –PQLColumn objects of query representing columns of query.
-
filters
(
List[PQLFilter]
) –PQLFilter objects of query filtering result.
-
order_by_columns
(
List[OrderByColumn]
) –OrderByColumns used to sort result. First column is most important and last column least important.
-
distinct
(
bool
) –If true, result only contains distinct rows and no duplicates.
-
limit
(
Optional[pydantic.NonNegativeInt]
) –Output rows are limited to
limit
rows. If None, all rows are returned. -
offset
(
Optional[pydantic.NonNegativeInt]
) –Output skips
offset
first rows. If None, no rows are skipped.
order_by_columns
class-attribute
instance-attribute
¶
queries
property
¶
Returns list of string queries that can be used to export data.
Returns:
-
List[str]
–List of query strings.
add ¶
Adds object to PQL object depending on object type.
Parameters:
-
obj
(
Union[PQLColumn, PQLFilter, Iterable[Union[PQLColumn, PQLFilter, OrderByColumn]]]
) –Object to add to PQL query. Can be either PQLColumn, PQLFilter, OrderByColumn, or a list of these objects.
Raises:
-
TypeError
–Raised if object type does not match supported types.