Skip to content

pql

Module to interact with PQL queries.

This module contains class to interact with PQL queries including columns and filters.

Typical usage example
query = PQL(distinct=True)
query += PQLColumn(name="column", query='"TABLE"."COLUMN"')
query += PQLFilter(query='FILTER "TABLE"."COLUMN" = 1;')
query += OrderByColumn(query='"TABLE"."COLUMN"', ascending=False)

PQLColumn

Bases: PyCelonisBaseModel

Class representing PQL column of OLAP table.

Attributes:

  • name (str) –

    Name of the column.

  • query (str) –

    PQL query of the column.

name class-attribute

name: str

query class-attribute

query: str

PQLFilter

Bases: PyCelonisBaseModel

Class representing PQL filter.

Attributes:

  • query (str) –

    Query of PQL filter. Needs to have format 'FILTER CONDITION;'.

query class-attribute

query: str

OrderByColumn

Bases: PyCelonisBaseModel

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.

query class-attribute

query: str

ascending class-attribute

ascending: bool = True

PQL

Bases: PyCelonisBaseModel

Class representing PQL query that can be used for data export.

Attributes:

  • columns (CelonisCollection[PQLColumn]) –

    PQLColumn objects of query representing columns of query.

  • filters (CelonisCollection[PQLFilter]) –

    PQLFilter objects of query filtering result.

  • order_by_columns (CelonisCollection[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 (typing.Optional[pydantic.NonNegativeInt]) –

    Output rows are limited to limit rows. If None, all rows are returned.

  • offset (typing.Optional[pydantic.NonNegativeInt]) –

    Output skips offset first rows. If None, no rows are skipped.

columns class-attribute

columns: CelonisCollection[PQLColumn] = Field(
    default_factory=CelonisCollection
)

filters class-attribute

filters: CelonisCollection[PQLFilter] = Field(
    default_factory=CelonisCollection
)

order_by_columns class-attribute

order_by_columns: CelonisCollection[OrderByColumn] = Field(
    default_factory=CelonisCollection
)

distinct class-attribute

distinct: bool = False

limit class-attribute

limit: typing.Optional[pydantic.NonNegativeInt]

offset class-attribute

offset: typing.Optional[pydantic.NonNegativeInt]

queries property

queries()

Returns list of string queries that can be used to export data.

add

add(obj)

Adds object to PQL object depending on object type.

Parameters:

Raises: