Skip to main content

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.
Like a family tree for data. A “TemperatureAlert” is a child of “Alert”—it inherits all the standard alert properties (ID, timestamp, severity) but adds its own temperature-specific fields. Change the parent, and all children get the update.

When to Use Inheritance


Inheritance Syntax

The FROM keyword creates a child model that inherits all fields from a parent:
The child model automatically includes every field from the parent, plus any additional fields you define.

How It Works

Result: TemperatureAlert has 8 fields total:
  • 5 inherited from BaseAlert (alert_id, timestamp, severity, message, acknowledged)
  • 3 specialized fields (temperature_value, threshold_exceeded, sensor_location)
Base models are typically defined with COLLAPSED since they’re meant to be extended, not used directly. The child models inherit this behavior.

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

Don’t include type-specific fields in base models. If only some variants need a field, it belongs in the child model.

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 alerts add measurement data and thresholds:

Publishing Inherited Models

Inherited models work exactly like regular COLLAPSED models—use PUBLISH 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

A complete equipment monitoring system with specialized equipment types:
Action to publish equipment reports:

Best Practices

Only include fields that every child model needs. If only some variants use a field, it belongs in the child model, not the base.
Name child models to clearly indicate their specialization:
When you have multiple inheritance levels, keep the structure clear:
When using PUBLISH MODEL, you must provide values for both inherited and specialized fields:

Limitations

Current limitations of model inheritance:
  • Single inheritance only — A model can only inherit from one parent (no multiple inheritance)
  • No field override — Child models cannot redefine fields from the parent with different types
  • COLLAPSED required — Base models should use COLLAPSED since they’re templates, not triggered models

Next Steps

Publishing Models

Master the PUBLISH MODEL syntax for dynamic data creation.

Model Examples

See more inheritance examples in context.
Last modified on May 22, 2026