Skip to content

component

Module for analysis components.

AnalysisComponent

Bases: PyCelonisBaseModel

Class for analysis components.

id instance-attribute

id

Id of component.

type instance-attribute

type

Type of component (e.g. pql-table).

title instance-attribute

title

Title of component shown in UI.

componentFilter instance-attribute

componentFilter

Raw component filter.

get_filter

get_filter()

Returns filter of component.

Returns:

Examples:

Adding component filter to custom query and extract data:

sheet = analysis.get_content().draft.document.sheets[0]
olap_table = sheet.components.find("#{OLAP Table}", search_attribute="title")

query = PQL() + PQLColumn(name="TEST", query="<query")
query += olap_table.get_filter()

data_query, query_environment = analysis.resolve_query(query)
df = data_model.export_data_frame(data_query, query_environment)

DataComponent

Bases: ABC, AnalysisComponent

Abstract component class for components displaying data.

id instance-attribute

id

Id of component.

type instance-attribute

type

Type of component (e.g. pql-table).

title instance-attribute

title

Title of component shown in UI.

componentFilter instance-attribute

componentFilter

Raw component filter.

get_filter

get_filter()

Returns filter of component.

Returns:

Examples:

Adding component filter to custom query and extract data:

sheet = analysis.get_content().draft.document.sheets[0]
olap_table = sheet.components.find("#{OLAP Table}", search_attribute="title")

query = PQL() + PQLColumn(name="TEST", query="<query")
query += olap_table.get_filter()

data_query, query_environment = analysis.resolve_query(query)
df = data_model.export_data_frame(data_query, query_environment)

get_query

get_query(use_translated_names=True)

Returns full query with column and filter for component.

Parameters:

  • use_translated_names (bool, default: True ) –

    If true, the translated names will be used as column names. If false, default names will be used.

Returns:

  • PQL

    A PQL query.

Examples:

Adding component query (columns + filters) to custom query and extract data:

sheet = analysis.get_content().draft.document.sheets[0]
olap_table = sheet.components.find("#{OLAP Table}", search_attribute="title")

query = PQL() + PQLColumn(name="TEST", query="<query")
query += olap_table.get_query()

data_query, query_environment = analysis.resolve_query(query)
df = data_model.export_data_frame(data_query, query_environment)

get_columns

get_columns(use_translated_names=True)

Returns all columns of component including dimensions and kpis.

Parameters:

  • use_translated_names (bool, default: True ) –

    If true, the translated names will be used as column names. If false, default names will be used.

Returns:

Examples:

Adding component columns to custom query and extract data:

sheet = analysis.get_content().draft.document.sheets[0]
olap_table = sheet.components.find("#{OLAP Table}", search_attribute="title")

query = PQL() + PQLColumn(name="TEST", query="<query")
query += olap_table.get_columns()

data_query, query_environment = analysis.resolve_query(query)
df = data_model.export_data_frame(data_query, query_environment)

SingleKPI

Bases: DataComponent

Class for gauges, numbers, fills, etc.

id instance-attribute

id

Id of component.

type instance-attribute

type

Type of component (e.g. pql-table).

title instance-attribute

title

Title of component shown in UI.

componentFilter instance-attribute

componentFilter

Raw component filter.

TYPE class-attribute

TYPE = 'single-kpi'

formula instance-attribute

formula

get_filter

get_filter()

Returns filter of component.

Returns:

Examples:

Adding component filter to custom query and extract data:

sheet = analysis.get_content().draft.document.sheets[0]
olap_table = sheet.components.find("#{OLAP Table}", search_attribute="title")

query = PQL() + PQLColumn(name="TEST", query="<query")
query += olap_table.get_filter()

data_query, query_environment = analysis.resolve_query(query)
df = data_model.export_data_frame(data_query, query_environment)

get_query

get_query(use_translated_names=True)

Returns full query with column and filter for component.

Parameters:

  • use_translated_names (bool, default: True ) –

    If true, the translated names will be used as column names. If false, default names will be used.

Returns:

  • PQL

    A PQL query.

Examples:

Adding component query (columns + filters) to custom query and extract data:

sheet = analysis.get_content().draft.document.sheets[0]
olap_table = sheet.components.find("#{OLAP Table}", search_attribute="title")

query = PQL() + PQLColumn(name="TEST", query="<query")
query += olap_table.get_query()

data_query, query_environment = analysis.resolve_query(query)
df = data_model.export_data_frame(data_query, query_environment)

get_columns

get_columns(use_translated_names=True)

Returns all columns of component including dimensions and kpis.

Parameters:

  • use_translated_names (bool, default: True ) –

    If true, the translated names will be used as column names. If false, default names will be used.

Returns:

Examples:

Adding component columns to custom query and extract data:

sheet = analysis.get_content().draft.document.sheets[0]
olap_table = sheet.components.find("#{OLAP Table}", search_attribute="title")

query = PQL() + PQLColumn(name="TEST", query="<query")
query += olap_table.get_columns()

data_query, query_environment = analysis.resolve_query(query)
df = data_model.export_data_frame(data_query, query_environment)

PQLTable

Bases: DataComponent

Class for OLAP tables, column charts, line charts, etc.

id instance-attribute

id

Id of component.

type instance-attribute

type

Type of component (e.g. pql-table).

title instance-attribute

title

Title of component shown in UI.

componentFilter instance-attribute

componentFilter

Raw component filter.

TYPE class-attribute

TYPE = 'pql-table'

distinct instance-attribute

distinct

axis0 instance-attribute

axis0

axis1 instance-attribute

axis1

axis2 instance-attribute

axis2

get_filter

get_filter()

Returns filter of component.

Returns:

Examples:

Adding component filter to custom query and extract data:

sheet = analysis.get_content().draft.document.sheets[0]
olap_table = sheet.components.find("#{OLAP Table}", search_attribute="title")

query = PQL() + PQLColumn(name="TEST", query="<query")
query += olap_table.get_filter()

data_query, query_environment = analysis.resolve_query(query)
df = data_model.export_data_frame(data_query, query_environment)

get_columns

get_columns(use_translated_names=True)

Returns all columns of component including dimensions and kpis.

Parameters:

  • use_translated_names (bool, default: True ) –

    If true, the translated names will be used as column names. If false, default names will be used.

Returns:

Examples:

Adding component columns to custom query and extract data:

sheet = analysis.get_content().draft.document.sheets[0]
olap_table = sheet.components.find("#{OLAP Table}", search_attribute="title")

query = PQL() + PQLColumn(name="TEST", query="<query")
query += olap_table.get_columns()

data_query, query_environment = analysis.resolve_query(query)
df = data_model.export_data_frame(data_query, query_environment)

get_query

get_query(use_translated_names=True)

Returns full query with all columns and filter for component.

Parameters:

  • use_translated_names (bool, default: True ) –

    If true, the translated names will be used as column names. If false, default names will be used.

Returns:

  • PQL

    A PQL query.

Examples:

Adding table query to custom query and extract data:

sheet = analysis.get_content().draft.document.sheets[0]
olap_table = sheet.components.find("#{OLAP Table}", search_attribute="title")

query = PQL() + PQLColumn(name="TEST", query="<query")
query += olap_table.get_query()

data_query, query_environment = analysis.resolve_query(query)
df = data_model.export_data_frame(data_query, query_environment)

get_order_by_columns

get_order_by_columns()

Returns order by columns of component.

Returns:

PivotTable

Bases: DataComponent

Class for Pivot Tables.

id instance-attribute

id

Id of component.

type instance-attribute

type

Type of component (e.g. pql-table).

title instance-attribute

title

Title of component shown in UI.

componentFilter instance-attribute

componentFilter

Raw component filter.

TYPE class-attribute

TYPE = 'pivot'

axis0 instance-attribute

axis0

axis1 instance-attribute

axis1

axis2 instance-attribute

axis2

get_filter

get_filter()

Returns filter of component.

Returns:

Examples:

Adding component filter to custom query and extract data:

sheet = analysis.get_content().draft.document.sheets[0]
olap_table = sheet.components.find("#{OLAP Table}", search_attribute="title")

query = PQL() + PQLColumn(name="TEST", query="<query")
query += olap_table.get_filter()

data_query, query_environment = analysis.resolve_query(query)
df = data_model.export_data_frame(data_query, query_environment)

get_query

get_query(use_translated_names=True)

Returns full query with column and filter for component.

Parameters:

  • use_translated_names (bool, default: True ) –

    If true, the translated names will be used as column names. If false, default names will be used.

Returns:

  • PQL

    A PQL query.

Examples:

Adding component query (columns + filters) to custom query and extract data:

sheet = analysis.get_content().draft.document.sheets[0]
olap_table = sheet.components.find("#{OLAP Table}", search_attribute="title")

query = PQL() + PQLColumn(name="TEST", query="<query")
query += olap_table.get_query()

data_query, query_environment = analysis.resolve_query(query)
df = data_model.export_data_frame(data_query, query_environment)

get_columns

get_columns(use_translated_names=True)

Returns all columns of component including dimensions and kpis.

Parameters:

  • use_translated_names (bool, default: True ) –

    If true, the translated names will be used as column names. If false, default names will be used.

Returns:

Examples:

Adding component columns to custom query and extract data:

sheet = analysis.get_content().draft.document.sheets[0]
olap_table = sheet.components.find("#{OLAP Table}", search_attribute="title")

query = PQL() + PQLColumn(name="TEST", query="<query")
query += olap_table.get_columns()

data_query, query_environment = analysis.resolve_query(query)
df = data_model.export_data_frame(data_query, query_environment)

Boxplot

Bases: DataComponent

Class for Box Plots.

id instance-attribute

id

Id of component.

type instance-attribute

type

Type of component (e.g. pql-table).

title instance-attribute

title

Title of component shown in UI.

componentFilter instance-attribute

componentFilter

Raw component filter.

TYPE class-attribute

TYPE = 'boxplot'

dimension instance-attribute

dimension

distribution instance-attribute

distribution

get_filter

get_filter()

Returns filter of component.

Returns:

Examples:

Adding component filter to custom query and extract data:

sheet = analysis.get_content().draft.document.sheets[0]
olap_table = sheet.components.find("#{OLAP Table}", search_attribute="title")

query = PQL() + PQLColumn(name="TEST", query="<query")
query += olap_table.get_filter()

data_query, query_environment = analysis.resolve_query(query)
df = data_model.export_data_frame(data_query, query_environment)

get_query

get_query(use_translated_names=True)

Returns full query with column and filter for component.

Parameters:

  • use_translated_names (bool, default: True ) –

    If true, the translated names will be used as column names. If false, default names will be used.

Returns:

  • PQL

    A PQL query.

Examples:

Adding component query (columns + filters) to custom query and extract data:

sheet = analysis.get_content().draft.document.sheets[0]
olap_table = sheet.components.find("#{OLAP Table}", search_attribute="title")

query = PQL() + PQLColumn(name="TEST", query="<query")
query += olap_table.get_query()

data_query, query_environment = analysis.resolve_query(query)
df = data_model.export_data_frame(data_query, query_environment)

get_columns

get_columns(use_translated_names=True)

Returns all columns of component including dimensions and kpis.

Parameters:

  • use_translated_names (bool, default: True ) –

    If true, the translated names will be used as column names. If false, default names will be used.

Returns:

Examples:

Adding component columns to custom query and extract data:

sheet = analysis.get_content().draft.document.sheets[0]
olap_table = sheet.components.find("#{OLAP Table}", search_attribute="title")

query = PQL() + PQLColumn(name="TEST", query="<query")
query += olap_table.get_columns()

data_query, query_environment = analysis.resolve_query(query)
df = data_model.export_data_frame(data_query, query_environment)

WorldMap

Bases: DataComponent

Class for World Map Plots.

id instance-attribute

id

Id of component.

type instance-attribute

type

Type of component (e.g. pql-table).

title instance-attribute

title

Title of component shown in UI.

componentFilter instance-attribute

componentFilter

Raw component filter.

TYPE class-attribute

TYPE = 'world-map'

formula instance-attribute

formula

kpiFormula instance-attribute

kpiFormula

tooltipFormula instance-attribute

tooltipFormula

get_filter

get_filter()

Returns filter of component.

Returns:

Examples:

Adding component filter to custom query and extract data:

sheet = analysis.get_content().draft.document.sheets[0]
olap_table = sheet.components.find("#{OLAP Table}", search_attribute="title")

query = PQL() + PQLColumn(name="TEST", query="<query")
query += olap_table.get_filter()

data_query, query_environment = analysis.resolve_query(query)
df = data_model.export_data_frame(data_query, query_environment)

get_query

get_query(use_translated_names=True)

Returns full query with column and filter for component.

Parameters:

  • use_translated_names (bool, default: True ) –

    If true, the translated names will be used as column names. If false, default names will be used.

Returns:

  • PQL

    A PQL query.

Examples:

Adding component query (columns + filters) to custom query and extract data:

sheet = analysis.get_content().draft.document.sheets[0]
olap_table = sheet.components.find("#{OLAP Table}", search_attribute="title")

query = PQL() + PQLColumn(name="TEST", query="<query")
query += olap_table.get_query()

data_query, query_environment = analysis.resolve_query(query)
df = data_model.export_data_frame(data_query, query_environment)

get_columns

get_columns(use_translated_names=True)

Returns all columns of component including dimensions and kpis.

Parameters:

  • use_translated_names (bool, default: True ) –

    If true, the translated names will be used as column names. If false, default names will be used.

Returns:

Examples:

Adding component columns to custom query and extract data:

sheet = analysis.get_content().draft.document.sheets[0]
olap_table = sheet.components.find("#{OLAP Table}", search_attribute="title")

query = PQL() + PQLColumn(name="TEST", query="<query")
query += olap_table.get_columns()

data_query, query_environment = analysis.resolve_query(query)
df = data_model.export_data_frame(data_query, query_environment)

ComponentFactory

Factory class to create AnalysisComponent with given type.

get_component staticmethod

get_component(component)

Returns instance of AnalysisComponent depending on type.

Parameters:

  • component (AnalysisComponent) –

    AnalysisComponent containing properties of component.

Returns:

get_components staticmethod

get_components(components)

Returns instances of AnalysisComponent depending on type.

Parameters:

  • components (List[AnalysisComponent]) –

    List of AnalysisComponent containing properties of components.

Returns: