Skip to main content
Question

Automation scope to save multiple records into knowledge model

  • April 30, 2026
  • 1 reply
  • 63 views

Pratheeksha
Level 2
Forum|alt.badge.img

Hello Everyone, 

Working on a task where I need to save multiple components from a lot analyses into the knowledge model.

Is there any way we can fasten up things using pycelonis? It will help me save a lot records into the knowledge model without manually creating records in the knowledge model. 

1 reply

gagan1
Level 10
Forum|alt.badge.img+3
  • Level 10
  • May 1, 2026

Hi ​@Pratheeksha , Yeah PyCelonis is exactly what u want for this, will save u hours of manual data entry.

Assuming you are on a recent PyCelonis 2.x version (version 2.6+ added full native CRUD support for knowledge models[1]), you can just pull the components or formulas from your analysis and loop them directly into the KM.

The general logic looks something like this:

 

km = package.get_knowledge_models().find('Your KM Name')
analysis = package.get_analyses().find('Your Analysis Name')

# loop through your analysis components or saved formulas
for item in your_extracted_components:
km.add_record(
id="generate_a_unique_id_here",
display_name=item.name,
# map your PQL, attributes, etc. based on the analysis component
)
# u can also use km.create_kpi() if you are migrating KPIs

Pro-tip: Watch out for duplicate IDs when doing batch inserts. If the record or KPI ID already exists in the Knowledge Model, PyCelonis will usually throw an error. I usually check km.get_content().records first to see if it's already there, or just wrap the create step in a basic try/except block so one duplicate doesn't break the whole loop.