Add Events

Creates and inserts new synthetic events into the eventstream. Exactly one source mode must be provided.

Usage

# Copy existing events under a new name
es.add_events("conversion", source_events=["purchase", "subscription"])

# Create events using SQL
es.add_events("high_value_purchase", sql="""
    SELECT * FROM df
    WHERE event = 'purchase' AND revenue > 100
""")

# Insert a churn event after 30 days of inactivity
es.add_events("churn", churn={"inactivity_days": 30})

Parameters

ParameterTypeDescription
new_event_namestrName of the new synthetic event.
source_eventslist[str] | NoneMode 1. Existing event names to copy. Each matching row is duplicated and renamed.
sqlstr | NoneMode 2. DuckDB SQL selecting from eventstream. Matching rows are copied and renamed.
churndict | NoneMode 3. Inserts a churn event after inactivity. Dict keys: inactivity_days (float, required), active_events (list[str], optional — only these events count as activity).