Skip to main content
Solved

Getting pool versions using python


Hello All,

 

 

 

I want to use pycelonis to get all version of data pool (including Draft if present)

 

The below code does not not show data pool version 

 

 

 

data_pool = celonis.pools.find("XXXXXXXXXXXXXXXX)

 

print (data_pool)

 

 

Output:

 

<Pool, id XXXXXXXXXXXXXXXX, name 000_Extraction (000_CELONIS_DATA)>

 

 

 

Is there any way i could get the data pool versions?

 

Best answer by deleted.delet27

Hi,

 

I think I've got solution:

 

1) You can retrieve version list by sending GET request with Pycelonis to below URL:

https://<Team_name>.celonis.cloud/integration/api/pools/<pool_id>/versions

 

obraz 

2) You can loop through them and get detailed info

 

https://<team_name>.celonis.cloud/integration/api/pools/<data_pool_id>/versions/<version_id>/serializedContent

 

3) To get current setting you can use normal pycelonis datapool object mentioned by @Guillermo Gost 

 

Standard code snippet:

 

URL = "<PUT URL HERE>"

celonis = get_celonis(url='https://<team_name>.celonis.cloud',key_type='APP_KEY', permissions=False)

json = celonis.api_request(URL, message=None, method='auto', timeout='default', get_json=True)

df = pd.DataFrame.from_dict(json['<dictionaryKey>'], orient='columns')

 

#Pushing data to CElonis

data_pool = celonis.pools.find("<DataPoolID>")

data_pool.create_table(table_name="<NewTableName>",

                      df_or_path=df,

                     if_exists="drop")

 

#Viewing data frame

df

 

If that solve your problem, please mark the answer as best :)

 

Best Regards,

Mateusz Dudek

View original

I made some checks, and sorry to say it seems you can't

 

This is the struct data of a pool, as you see there is nothing indicating the version (btw this pool should have versions 1.0 and 2.0

 

image 

If you find a way, please share!

 

 


Hi,

 

I think I've got solution:

 

1) You can retrieve version list by sending GET request with Pycelonis to below URL:

https://<Team_name>.celonis.cloud/integration/api/pools/<pool_id>/versions

 

obraz 

2) You can loop through them and get detailed info

 

https://<team_name>.celonis.cloud/integration/api/pools/<data_pool_id>/versions/<version_id>/serializedContent

 

3) To get current setting you can use normal pycelonis datapool object mentioned by @Guillermo Gost 

 

Standard code snippet:

 

URL = "<PUT URL HERE>"

celonis = get_celonis(url='https://<team_name>.celonis.cloud',key_type='APP_KEY', permissions=False)

json = celonis.api_request(URL, message=None, method='auto', timeout='default', get_json=True)

df = pd.DataFrame.from_dict(json['<dictionaryKey>'], orient='columns')

 

#Pushing data to CElonis

data_pool = celonis.pools.find("<DataPoolID>")

data_pool.create_table(table_name="<NewTableName>",

                      df_or_path=df,

                     if_exists="drop")

 

#Viewing data frame

df

 

If that solve your problem, please mark the answer as best :)

 

Best Regards,

Mateusz Dudek


Cool!!!


That looks promising, definitely going to try that out.

Thank you @deleted deleted and @Guillermo Gost 

 


Hmmmm.... I get a 200 and a result using this

 

Problem is that I can't find any datapool in my test environ with several versions... plus, with the new interface of Data Integration... I don't know how to save a version!!!! 😮

 

My code (pycelonis 2.0.1:

 

from pycelonis import get_celonis

pools=celonis.data_integration.get_data_pools() #To find one valid id

a=celonis.client.request(url='https://<Team_name>.celonis.cloud/integration/api/pools/53346212-b364-477f-adf1-d77f9d088ef5/versions', method='GET').json()

 

I get an empty json with a <Response [200 OK]>

 

 

HTH


Reply