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
| Parameter | Type | Description |
|---|---|---|
new_event_name | str | Name of the new synthetic event. |
source_events | list[str] | None | Mode 1. Existing event names to copy. Each matching row is duplicated and renamed. |
sql | str | None | Mode 2. DuckDB SQL selecting from eventstream. Matching rows are copied and renamed. |
churn | dict | None | Mode 3. Inserts a churn event after inactivity. Dict keys: inactivity_days (float, required), active_events (list[str], optional — only these events count as activity). |