Skip to main content
Question

How do you push a DataFrame to your DataPool in PyCelonis 2.7.0)

  • March 14, 2024
  • 2 replies
  • 57 views

miguel.ferna11
Level 3
Forum|alt.badge.img+13

This is the code I'm trying to execute:

 

celonis = get_celonis()

 

data_pool_name = "dataPool"

data_pool = celonis.data_integration.get_data_pools().find(data_pool_name)

 

column_config = [

  ColumnTransport(column_type = ColumnType.STRING, field_length = 10000)

]

 

data_pool_table = data_pool.create_table(df = dfResult, table_name = "tableName", drop_if_exists = True, column_config = column_config)

 

This is the error code:

 

Response: Server error '500 Internal Server Error'

 

The table "tableName" already exists with a defined column named "_COL" inside the DataPool, which has a specific DataModel with just that table. The pandas DataFrame dfResult is a 1x1 table with a string inside.

 

Does that error code mean only the Celonis server is to blame?

2 replies

mallik.koruk11
Level 6
Forum|alt.badge.img+8

Try upsert_table instead of creating, there might be a table with same name already exists in the Data Pool.

 

data_pool.upsert_table(df_or_path=dataframe, table_name=table_name, primary_keys=primary_keys)


deeksha.r12
Level 7
Forum|alt.badge.img
  • Level 7
  • March 21, 2024

Hi @miguel.ferna11 

If you want the output dataframe to be created as a new table, you can try this:

 

data_pool = celonis.data_integration.get_data_pool('DATA POOL ID')

data_pool

data_pool.create_table(df=output_df, table_name="NEW TABLE NAME", drop_if_exists=True)