Skip to main content

Hello @All

 

i'm trying to export data from an ready/productive Analysis with pycelonis.

 

My Analysis has a table, from which i got the query (compontent.get_query()). With this query i wanted to export the dataframes (data_model.export_data_frame(query)).

I'm getting some errors on all variables and saved formulas.

e.g: PQLColumn(name='<%=ZZ_ABC1%>', query='<%=ZZ_GHJ2%>'),

 

Is there an option to use variables & saved formulas in pycelonis export?

 

Thanks in advance!

 

 

Hi @markus.wagne,

 

It is not impossible, but also not easy.

 

What you could do is extract the content of the analysis, and use text replace to replace the values of your query by the values that are defined in your analysis. If you have nested content in your variables and formulas, the text replacement step should be repeated until everything is parsed.

Using objects (such as KPIs and Filters) from the Knowledge Model is far more easier, so I would recommend to consider using the KM for a next project.

 

Getting the formulas and variables can be done using this Python snippet:

 

import json

import pycelonis

 

# Connect to Celonis

celonis = pycelonis.get_celonis()

 

# Show Packages

celonis.packages

# Select Package

package = celonis.packages.find('<package_id>')

 

# Show Analyses

package.analyses

# Select Analysis

analysis = package.analyses.find('<analysis_id>')

 

# Load Analysis data

analysis_dict = json.loads(analysis.datas'serializedContent'])

 

# Get KPIs

analysis_dicty'kpis']

 

# Get Variables

analysis_dictl'draft']r'document']m'variables']


Hi @janpeter.van.d ,

Thanks for your reply above. I'm involved in the same project that my colleague Markus mentioned above. In the meantime we have migrated our analysis to the KM. What do you exactly mean with

"Using objects (such as KPIs and Filters) from the Knowledge Model is far more easier, so I would recommend to consider using the KM for a next project." ?

How does this make it easier for us to export data from a table?

 

Thanks a lot in advance!

 

Best,

Jonas


Hi @Jonas Scheidel,

 

If you have all your definitions in your Knowledge Model, you can export date directly from your data model without having the need for the Analysis.

With the newer versions of PyCelonis, these functions are implemented using the SoalaPy interface which can use the Knowledge Model to resolve queries (old version and explanation can be found here: https://celonis.github.io/pycelonis/2.5.0/reference/pycelonis/ems/studio/content_node/knowledge_model/#pycelonis.ems.studio.content_node.knowledge_model.KnowledgeModel.resolve_query). So, to ensure that use the latest techniques which are likely to be supported over a longer period, I would recommend using Knowledge Model.

 

Next to this use case, you also see that all other Celonis components are moving towards this (Triggers for Action Flows, Formula's in Views etc.)


Hi @janpeter.van.d ,

thanks a lot for your reply!:)

 

Best,

Jonas


Hi @janpeter.van.d ,

again thanks for your support. Pulling data from a KM is working now :)

 

Best,

jonas


Hi @janpeter.van.d ,

again thanks for your support. Pulling data from a KM is working now :)

 

Best,

jonas

Hi Jonas,

 

Good to hear and thanks for taking the time to share your experience. Good luck with your further use cases!

 

Best regards,

Jan-peter


Hi Jonas,

 

Good to hear and thanks for taking the time to share your experience. Good luck with your further use cases!

 

Best regards,

Jan-peter

Hi @janpeter.van.d ,

 

sry a further question. We only have to maintain kpi logics, variables... in one place with the KM. So far so good, that's already an improvement. But is it also possible to pull data directly from a view?

We extract data from Celonis to BW. Our long-term goal is that changes in a view are automatically transferred to BW without having to adapt a Python script.

For example, if I want to extract a new additional attribute, I have to adapt my python script. It would be nicer if I only have to add the attribute in the OLAP table in our view. And then the customised table is extracted from the view.

I hope it was explained clearly.

 

Thanks in advance!

 

Best,

Jonas


Hi Jonas,

 

Good to hear and thanks for taking the time to share your experience. Good luck with your further use cases!

 

Best regards,

Jan-peter

Hi Jonas,

 

Interesting use case and I see what you are looking for. Long answer short: this is not possible without doing some tricks.

View Components are just empty definitions in YAML without having any data behind them. Using this YAML configuration to obtain data is not supported out of the box, but is also not impossible.

However, next to the table configurations, there are some other options to interact with your Python script without having to adjust the script itself.

 

I have listed some ideas that could help you:

  1. Manual action but easier to implement:
  • Create a variable (for this use case I would use a Knowledge Model variable since your KPIs are also there) and store a list of columns in there that should be extracted.
    • Read out this variable the same way you do with your KPIs and parse it in the Python Code to a Query.
  1. In line with your request:

 

I hope this helps!

 


Hi Jonas,

 

Good to hear and thanks for taking the time to share your experience. Good luck with your further use cases!

 

Best regards,

Jan-peter

Hi Jan-peter,

Thanks a lot for your detailed answer, I will try it.:)

 

Best,

Jonas


Reply