Comes with concise functional calls to improve your coding experience
I remember when I first learned to program, I didn’t have a clue about classes, functions and variables, etc (in the case of Java back then). Silly old me thought variables must be named alphabetically, ranging from a to z until I exhaust all of them. 😀
As with most sample code snippets, function names are usually just symbolic. Looking at the code snippet above, are we able to tell what the function myMethod
does? What exactly is the variable Z
with regards to the input parameter x
and y
?
Function names shouldn’t be random. It should be as informative as possible to the person reviewing the code, and also as intuitive to the person writing the code. For instance, IMHO mySum
would be more informative than myMethod
in this case. In like manner, is mySum
or mySummation
better? K.I.S.S.-Keep It Short, Stupid…
What gets deprecated in Atoti v0.6.5?
What has the above got to do with the new Atoti v0.6.5 recently released? In this article, we are going to zoom in on the Deprecated section in the changelog.
To begin with, we see the verb “create” has been dropped from most deprecated functions and users are able to instantiate the classes directly. We went from a class and a function to create it to just a class, so the API is smaller and easier to learn.
Deprecating Atoti.create_session
This change affects all users of Atoti. We can quickly instantiate an Atoti session by invoking Atoti.Session
directly. K.I.S.S. Remember it’s Session
with a capital letter S
.
One benefit of this change is that now we can directly pass the configurations as input parameters to the constructor. Consequently, we will be able to use the “Tab” key to see the available parameters for the function. This is definitely more user-friendly than the previous JSON input for the configuration to create_session
.
Client-side encryption in Atoti for Cloud connectivity
Similarly, in client-side encryption for Azure or AWS connection, we can now quickly instantiate the classes atoti_azure.AzureKeyPair
or atoti_aws.AwsKeyPair
as demonstrated below:
client_side_encryption_config = AwsKeyPair(
region="eu-west-3",
private_key="private_key",
public_key="public_key",
)
Alternatively, if you are using KMS configuration for AWS:
from atoti_aws import AwsKmsConfig
client_side_encryption_config = (
AwsKmsConfig(
region="eu-west-3",
key_id="key_id",
),
)
Predefined ordering for members of levels
When we query a cube, we can define the default order for the members of the level. In the previous versions, we had:
- Atoti.comparator.ASCENDING
- Atoti.comparator.DESCENDING
- Atoti.comparator.first_members()
The functions are now streamlined to the following:
So, to order a level in descending order:
h, l, m = cube.hierarchies, cube.levels, cube.measures
l["date"].order = tt.NaturalOrder(ascending=False)
On the other hand, Atoti.CustomOrder
allows us to fix the order of the members to any predefined sequence:
l["Month"].order = tt.CustomOrder(
first_elements=[
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December",
]
)
Integrate Atoti with Kafka for real-time messaging
For real-time messaging, Atoti is able to integrate with Kafka as shown below. We can use the default JSON_DESERIALIZER
to consume incoming messages.
trade_attributes.load_kafka(
bootstrap_server="localhost:9092",
topic="trades",
group_id="Atoti-trades-consumer",
deserializer=atoti_kafka.JSON_DESERIALIZER,
)
Check out our Real-time Risk notebook if you’re interested to learn more.
Improving syntax for better user experience
If you’re unsure of the syntax, use the “Tab” key to auto-suggest the list of available functions. Use “Shift+tab” to display the function description.
We are constantly improving our library to provide a better experience for our users. For that reason, we have prepared a wide variety of examples across different topics in our Atoti notebook gallery for your reference.
Finally, we love to hear from you. Reach out to us on the Atoti GitHub discussions forum.