atoti.query package

Submodules

atoti.query.auth module

Query Authentication.

atoti.query.auth.Auth = typing.Callable[[str], typing.Union[typing.Dict[str, str], NoneType]]

Called with the URL of the request and returns the HTTP headers necessary to authenticate it.

atoti.query.basic_auth module

Basic Authentication.

class atoti.query.basic_auth.BasicAuthentication(username, password)

Bases: object

Basic Authentication.

It can be used on the server sandbox for instance.

password: str = None
username: str = None

atoti.query.cube module

Query cube.

class atoti.query.cube.QueryCube(name, hierarchies, measures, _session)

Bases: object

Query cube.

hierarchies: QueryHierarchies = None
property levels

Levels of the cube.

Return type

QueryLevels

measures: QueryMeasures = None
name: str = None
query(*measures, levels=None, condition=None, scenario='Base', timeout=30, **kwargs)

Query the cube to get the value of some measures.

The value of the measures is given on all the members of the given levels. If no measure is specified then all the measures are returned. If no level is specified then the value at the top level is returned

Parameters
  • measures (QueryMeasure) – the measures to query.

  • levels (Union[QueryLevel, Sequence[QueryLevel], None]) – the levels to split on.

  • condition (Union[LevelCondition, MultiCondition, None]) –

    the filtering condition. Only conditions on level equality with a string are supported. For instance:

    • lvl["Country"] == "France"

    • (lvl["Country"] == "USA") & (lvl["Currency"] == "USD")

  • scenario (str) – the scenario to query.

  • timeout (int) – the query timeout in seconds.

Return type

DataFrame

Returns

the resulting DataFrame.

atoti.query.cubes module

Query cubes.

class atoti.query.cubes.QueryCubes(_data)

Bases: atoti._mappings.ImmutableMapping

Manage the query cubes.

atoti.query.hierarchies module

Query hierarchies.

class atoti.query.hierarchies.QueryHierarchies(_data)

Bases: atoti._mappings.ImmutableMapping

Manage the query hierarchies.

atoti.query.hierarchy module

Query hierarchy.

class atoti.query.hierarchy.QueryHierarchy(name, dimension, levels, slicing)

Bases: object

Hierarchy for query cube.

dimension: str = None
levels: ImmutableMapping[str, QueryLevel] = None
name: str = None
slicing: bool = None

atoti.query.level module

Query level.

class atoti.query.level.QueryLevel(name, dimension, hierarchy)

Bases: object

Level for query cube.

dimension: str = None
hierarchy: str = None
name: str = None

atoti.query.levels module

Query levels.

class atoti.query.levels.QueryLevels(_hierarchies)

Bases: atoti._base_levels.BaseLevels

Flat representation of all the levels in the cube.

atoti.query.measure module

Query measure.

class atoti.query.measure.QueryMeasure(name, visible, folder, formatter)

Bases: object

Query measure.

folder: Optional[str] = None
formatter: Optional[str] = None
name: str = None
visible: bool = None

atoti.query.measures module

Query measures.

class atoti.query.measures.QueryMeasures(_data)

Bases: atoti._mappings.ImmutableMapping

Manage the query measures.

atoti.query.session module

Making MDX queries on existing sessions.

class atoti.query.session.QuerySession(url, auth=None, name=None)

Bases: object

Used to query an existing session.

property cubes

Cubes of the session.

Return type

QueryCubes

property name

Name of the session.

Return type

str

query_mdx(mdx, timeout=30, **kwargs)

Execute an MDX SELECT query and return its result as a pandas DataFrame.

Parameters
  • mdx (str) – the MDX SELECT query to execute

  • timeout (int) – the query timeout in seconds

Return type

DataFrame

Returns

the resulting DataFrame

property url

URL of the session.

Return type

str

Module contents

Package to query an existing session.

atoti.query.open_query_session(url, auth=None, name=None)

Join an existing session to query it.

Parameters
  • url (str) – the server base URL, if {url} is given, {url}/versions/rest is expected to exist

  • auth (Optional[Callable[[str], Optional[Dict[str, str]]]]) – the authentication to use

  • name (Optional[str]) – the name to give to the session, default to the given URL

Return type

QuerySession

Returns

The query session.