Why Use Model Inheritance?
When your system has related data types—different kinds of alerts, equipment, or events—you often repeat the same fields across multiple models. Model inheritance lets you define common fields once in a base model, then extend it with specialized fields for each variant.When to Use Inheritance
Inheritance Syntax
TheFROM keyword creates a child model that inherits all fields from a parent:
How It Works
TemperatureAlert has 8 fields total:
- 5 inherited from
BaseAlert(alert_id, timestamp, severity, message, acknowledged) - 3 specialized fields (temperature_value, threshold_exceeded, sensor_location)
Designing Base Models
A good base model contains fields that every variant needs. Put yourself in the position of someone processing alerts, equipment data, or events—what fields do they always expect?Base Model Best Practices
What to Include in Base Models
Creating Specialized Models
Child models add fields specific to their domain. Keep these focused—only add what that particular variant needs.Alert Family Example
Starting from a common base, create specialized alert types:- Temperature Alert
- Pressure Alert
- Maintenance Alert
Temperature alerts add measurement data and thresholds:
Publishing Inherited Models
Inherited models work exactly like regular COLLAPSED models—usePUBLISH MODEL from an Action and provide values for all fields (inherited + specialized):
Polymorphic Action Pattern
One Action can handle multiple model types by checking the incoming data and publishing the appropriate variant:All alert types share the same base structure, so downstream systems can process common fields (like
severity and acknowledged) without knowing the specific alert type.Complete Examples
- Equipment Hierarchy
- Event Tracking
- Sensor Network
A complete equipment monitoring system with specialized equipment types:Action to publish equipment reports:
Best Practices
Keep Base Models Focused
Keep Base Models Focused
Only include fields that every child model needs. If only some variants use a field, it belongs in the child model, not the base.
Use Descriptive Model Names
Use Descriptive Model Names
Name child models to clearly indicate their specialization:
Document the Hierarchy
Document the Hierarchy
When you have multiple inheritance levels, keep the structure clear:
Provide All Fields When Publishing
Provide All Fields When Publishing
When using
PUBLISH MODEL, you must provide values for both inherited and specialized fields:Limitations
Next Steps
Publishing Models
Master the PUBLISH MODEL syntax for dynamic data creation.
Model Examples
See more inheritance examples in context.

