Skip to main content
Question

Writing/Modifying transformation codes (SQL) within data jobs using pycelonis in Machine Learning Workbench

  • June 15, 2026
  • 1 reply
  • 62 views

Pratheeksha
Level 3
Forum|alt.badge.img

I am able to retrieve the SQL transformation codes from the datajobs into Machine Learning workbench using pycelonis. But can I modify/write a new SQL code within the transformation directly in Machine learning workbench or is there no option for that? 

Please provide some clarity one this.

1 reply

m.sanchezmedina
Celonaut

Hi Pratheeksha,

 

Have you tried the `task.update_statement()` function from pycelonis? Here is the documentation for it.

 

Some dummy code:

from pycelonis import get_celonis

celonis = get_celonis()
data_pool = celonis.data_integration.get_data_pool("Data Pool ID")
data_job = data_pool.get_jobs("Data Job ID")

# Get the existing transformation
task = data_job.get_task("Transformation ID")

# Read current SQL
old_sql = task.get_statement()
print(old_sql)

# Overwrite with new SQL
new_sql = """
DROP TABLE IF EXISTS MY_TABLE;
CREATE TABLE MY_TABLE AS
SELECT *
FROM SOURCE_TABLE;
"""

task.update_statement(new_sql)

# Optional: verify
print(task.get_statement())

# Execute the job or only selected transformations
data_job.execute()