Use the Scripting API in a Model¶
Warning
The current page still doesn't have a translation for this language.
But you can help translating it: Contributing.
Use datamimic_ee.engine.runtime.scripting inside functions that a DSL script= expression calls. The API is read-only: container values are copied before they cross the boundary, so changing a returned dictionary never changes the active model.
The snapshot helpers return None, an empty mapping, or the supplied default when no matching value exists. load_memstore() and load_memstore_page() are stricter: they require an active evaluation context and a non-empty product name; paging additionally requires skip >= 0 and limit > 0.
Project script¶
| script/scripting_api.scr.py | |
|---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | |
Descriptor¶
| datamimic.xml | |
|---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | |
The <execute> element loads trusted project code. Keep the call itself inside script= so the evaluation context exists. For field lookup in nested products, use the separate scope guide.
The generated Scripting API reference lists the exact functions and signatures available in the current EE version.
Snapshot readers detach nested mappings, lists, tuples, sets, frozensets and bytearrays. Standard scalar data, Decimal, UUID and date/time/duration values are preserved; timezone-aware values require standard immutable timezones. Built-in variable iterators retain position/offset selection with independent backing data. Defaults belong to the caller. Custom objects and resource handles must be projected into supported data first (E013/I953). Cycles or excessive nesting produce E013/I954. Custom copy hooks are not executed. These restrictions apply to snapshot readers, not to general Python expression results.