Usage Guide 0.8.4

This section walks you through connecting Atoti Limits to an Atoti Server with the python API using the Atoti Limits Python plugin.

Usage

As of v0.8.0, the plugin allows you to connect your Atoti Server with an embedded Atoti Limits server and embedded Atoti Limits UI. This is the recommended approach for an out-of-the-box implementation only when connecting Atoti Limits to a single Atoti Server with the python API. If connecting to more than one Atoti Server then you should use a standalone Atoti Limits server

Alternatively, you can use the plugin without the embedded server or UI, in which case you will need to connect the plugin with an Atoti Limits server and Atoti Limits UI running on your machine.

Steps

1. Import

Import the necessary classes and functions from the atoti-limits package.

from atoti_limits.config import (
    limits_jwt_config,
    limits_data_config,
    limits_as_of_date_config
)
from atoti_limits.embedded import (
    embedded_limits_server,
    embedded_limits_ui
)

2. Configure the Atoti Limits source data folder

The Atoti Limits server requires a data folder:

  • You may create an empty source data folder with the initialize_limits_data_folder() function, or
  • You may point the server to an existing folder with the set_limits_data_folder() function.
# Data folder options (enable one)

# Option 1: initialize an empty data folder
#limits_data_config.initialize_limits_data_folder()

# Option 2: point to an existing data folder
limits_data_config.set_limits_data_folder("./data-samples")

3. Start the Python session

If using the embedded Atoti Limits server, you must start the session with the following attributes:

  • jwt = limits_jwt_config.LIMITS_JWT_CONFIG: this allows the Atoti Limits server to correctly authenticate the default users.
  • authentication=tt.BasicAuthenticationConfig(): this allows the Atoti Limits server to later correctly create the default users.

Alternatively, you can start your own Atoti Limits server, although unless you modify the JWT properties and user credentials you will still require these attributes.

If using the embedded Atoti Limits UI, you must start the session with the following attribute:

  • app_extensions = embedded_limits_ui.LIMITS_UI_APP_EXTENSION: this embeds the Atoti Limits UI.

Alternatively, you may serve your own Atoti Limits UI.

session = tt.Session(
    port = 6060,
    jwt = limits_jwt_config.LIMITS_JWT_CONFIG,
    authentication=tt.BasicAuthenticationConfig(),
    app_extensions=embedded_limits_ui.LIMITS_UI_APP_EXTENSION
)

note

The port value is arbitrary, but it is required in order for the auto-configuration feature of Atoti Limits to know which url to connect with.

4. Configure the Atoti Limits As-Of-Date

The Atoti Limits server requires an as-of-date to correctly evaluate limits. To set an as-of-date, create a hierarchy named “LimitsAsOfDate” from an existing date hierarchy in your cube, for example “Tax_date”.

limits_as_of_date_config.create_as_of_date_hierarchy(cube, cars_table, "Tax_Date")

5. Start the Embedded Atoti Limits server (optional)

embedded_limits_server.start()

This will start the embedded Atoti Limits server to connect with your embedded Atoti Server Python Cube. It is recommended to do this after the cube has started and the as-of-date has been configured, but this step can also be run after step 2.

Atoti Limits is connected!

The plugin will now connect to both the Atoti Limits server and the Atoti Limits UI. Navigate to http://localhost:6060 to view the Atoti Limits UI. Note that you may have to refresh your browser in case the connection has not yet completed.

Using a standalone Atoti Limits server

See the installation instructions for building a standalone server. Note that, by default, the atoti-limits plugin will attempt to connect to your Atoti Limits server using the following properties:

Property Default
limits.rest.url http://localhost:3090/limits/rest/v2/
limits.auth YWRtaW46YWRtaW4=
ap.auth YWRtaW46YWRtaW4=
content.server.auth YWRtaW46YWRtaW4=

Using a standalone Atoti Limits UI

See UI Activation for steps on how to configure your UI. Note that the default server name for the Atoti Python Cube as known by the Limits server is atoti and the default server key as known by the UI is default, so you will have to add the following in your Limits settings:

serverNameToServerKey: {
atoti: "default",
}