Usage Guide 0.6.4
This section walks you through connecting Atoti Limits to an Atoti Server with the python API using the Atoti Limits Python plugin.
Usage
1. Start the Limits server
Start the Limits server using the installation instructions in the Atoti Limits documentation and wait for a connection request.
2. Start the Python API
Create a session using the Python API, create a cube and wait for the python API to connect to the running Limits server. By default, the atoti-limits plugin will attempt to connect to Limits using the following properties:
Property | Default |
---|---|
limits.rest.url |
http://localhost:3090/limits/rest/v1/ |
limits.auth |
YWRtaW46YWRtaW4= |
ap.auth |
YWRtaW46YWRtaW4= |
content.server.auth |
YWRtaW46YWRtaW4= |
Note that it is no longer required to register the LookUpPostProcessor
as per previous Limits versions.
Example code to create the session and cube would look as follows:
import atoti as tt
from atoti import Session
# Create the session
session = tt.Session(
name="atoti",
port=6060
)
# At this point the Atoti+ session will attempt to connect to Limits. However, as the cube
# has not yet been created the connection request will not be sent.
# So let's create the cube:
# 1. Create the data table
session.create_table(
name="Cars",
types={
"CarName": tt.type.STRING,
"Price": tt.type.FLOAT,
"Date": tt.type.LOCAL_DATE,
},
keys=["CarName", "Date"]
)
# Note that we need to supply a slicing "Date" hierarchy. This is required by the LookUpPostProcessor
# to evaluate the Limit.
# 2. Load some data into the table
cars_table.load_csv("cars.csv")
# 3. Create the cube from the table
cube = session.create_cube(
base_table=cars_table,
name="Cars_Cube",
)
# 4. Set the date hierarchy as slicing, as per above
cube.hierarchies["Date"].slicing = True
At this point the Atoti+ session will send a connection request to the running Limits server and Limits will connect to the cube.
Limits is registered!
Now your Atoti+ instance is ready to wire into the Limits module.
You can now create Limit definitions in the Limits Module and configure the Limits Module to use your Atoti+ instance as an AP instance.