Skip to main content

Hi All,

Earlier I had asked a question regarding how we can save/extract a table in our EMS as a csv file in our machine learning work bench, seeing the reactions or the lack of replies I got for the topic I think it would be helpful if I explain the code that I used/found to save the file as csv in my ML workbench.

 

from pycelonis import get_celonis

import pycelonis.pql as pql

from pycelonis.config import Config

 

celonis = get_celonis()

data_pool = celonis.data_integration.get_data_pools().find("Datapool name")

data_model = data_pool.get_data_models().find("Datamodel name")

Config.DEFAULT_DATA_MODEL = data_model

tables = data_model.get_tables()

table_name = data_model.get_tables().find("Table to find out")

table_columns = table_name.get_columns()

df = pql.DataFrame(

  {

    "column1": table_columns.find("column name in the table which has to be extracted "),

    "column2": table_columns.find(" column name for column 2 "),

    "column3": table_columns.find("column name for column 3"),

    }

)

 

pandas_df = df.to_pandas()

pandas_df

 

df_to_csv_mode = True

filepath = "your filepath"

if df_to_csv_mode: pandas_df.to_csv(filepath + 'tablename.csv', encoding='utf-8', index=False)

 

(NB: I used pycelonis version 2.5.0 )

Thank you for the information @akshay.harid ! I'm sure this will come in handy to a lot of peers.


Thanks @noel.vasan 


Thank you.

The question now is how to get the .csv file via Action Flow to be able to push it into Sharepoint or send it via mail.

And I don't want to push the data into a data pool / data model again to make use of Celonis Query Data or Get rows.

 

Thanks,

Dennis


Thank you.

The question now is how to get the .csv file via Action Flow to be able to push it into Sharepoint or send it via mail.

And I don't want to push the data into a data pool / data model again to make use of Celonis Query Data or Get rows.

 

Thanks,

Dennis

Hi Dennis,

 

I came up with this kind of a approach for the exact use case you mentioned but for the time being I am also not aware how it can be done. But currently I am trying some python scripts in order to do so. Will be coming back with a update as soon as possible.

 

Thanks,

Akshay


Thank you.

The question now is how to get the .csv file via Action Flow to be able to push it into Sharepoint or send it via mail.

And I don't want to push the data into a data pool / data model again to make use of Celonis Query Data or Get rows.

 

Thanks,

Dennis

Hi,

 

Can't you simply query your data from Celonis module, grabing needed columns, use CSV or CSV Advanced module to create your file and use Microsoft 365 modules to either save in Sharepoint or send by Email? Provided the fact that your System/Network Admin grant you authorization to create an MS365 connection in Celonis, this should be quite straight forward without using any Python script upfront.

 

Unless I misundestood your requirement, of course...


Hi Christophe,

 

sure it is possible doing it the way described by you and we are doing it this way for most of the use cases but honestly speaking when we were still using CPM4 only way was to do this via Pycelonis and in my opinion it is quicker and easier to setup a pycelonis script that extracts data directly out of an analysis / view where all kind of filters are already applied to OLAP tables and push it into a DataFrame and create a .xlsx file (not .csv) out of it and with much more data in it than what can be handled by an Action Flow.

 

BR

Dennis


Hi Dennis,

 

Ok, from View perspective, fair enough.

 

Be well.

 

CC


Reply