Skip to main content
@overload
Cube.query(
    *measures: Measure,
    context: Mapping[str, bool | int | float | str] = frozendict({}),
    explain: Literal[False] = False,
    filter: CubeQueryFilterCondition | None = None,
    include_empty_rows: bool = False,
    include_totals: bool = False,
    levels: Sequence[Level] = (),
    mode: Literal[‘pretty’] = 'pretty',
    scenario: str | None = None,
) → MdxQueryResult
@overload
Cube.query(
    *measures: Measure,
    context: Mapping[str, bool | int | float | str] = frozendict({}),
    explain: Literal[False] = False,
    filter: CubeQueryFilterCondition | None = None,
    include_empty_rows: bool = False,
    include_totals: bool = False,
    levels: Sequence[Level] = (),
    mode: Literal[‘pretty’, ‘raw’] = 'pretty',
    scenario: str | None = None,
) → DataFrame
@overload
Cube.query(
    *measures: Measure,
    context: Mapping[str, bool | int | float | str] = frozendict({}),
    explain: Literal[True],
    filter: CubeQueryFilterCondition | None = None,
    include_empty_rows: bool = False,
    include_totals: bool = False,
    levels: Sequence[Level] = (),
    mode: Literal[‘pretty’, ‘raw’] = 'pretty',
    scenario: str | None = None,
) → object
Execute an MDX query. In JupyterLab with atoti-jupyterlab installed, query results can be converted to interactive widgets with the Convert to Widget Below action available in the command palette or by right clicking on the representation of the returned Dataframe.

Parameters

*measures

The measures to query.

context

Context values to use when executing the query. See shared_context for some of the available context values.

explain

When True, execute the query but, instead of returning its result, return an explanation of how it was executed containing a summary, global timings, and the query plan and all its retrievals.

filter

The filtering condition.
Single equality condition:
Combined equality condition:
Hierarchy condition:
Inequality condition:
Deep level of a multilevel hierarchy condition:
Measure condition:

include_empty_rows

Whether to keep the rows where all the requested measures have no value.

include_totals

Whether to query the grand total and subtotals and keep them in the returned DataFrame. Totals can be useful but they make the DataFrame harder to work with since its index will have some empty values.

levels

The levels to split on. If None, the value of the measures at the top of the cube is returned.

mode

The query mode.
  • "pretty" is best for queries returning small results.
  • "raw" is best for benchmarks or large exports:
    • A faster and more efficient endpoint reducing the data transfer from Java to Python will be used.
    • The Convert to Widget Below action provided by atoti-jupyterlab will not be available.

scenario

The name of the scenario to query.