@@ -298,6 +298,13 @@ def _parse_model(self, model_def: dict) -> Model | None:
298298 conversion_event = measure_def .get ("conversion_event" ),
299299 conversion_window = measure_def .get ("conversion_window" ),
300300 offset_window = measure_def .get ("offset_window" ),
301+ # Retention parameters
302+ cohort_event = measure_def .get ("cohort_event" ),
303+ activity_event = measure_def .get ("activity_event" ),
304+ periods = measure_def .get ("periods" ),
305+ retention_granularity = (measure_def .get ("retention_granularity" ) or measure_def .get ("granularity" ))
306+ if measure_def .get ("type" ) == "retention"
307+ else None ,
301308 # Cumulative/window parameters
302309 window = measure_def .get ("window" ),
303310 grain_to_date = measure_def .get ("grain_to_date" ),
@@ -414,6 +421,12 @@ def _parse_metric(self, metric_def: dict) -> Metric | None:
414421 conversion_event = metric_def .get ("conversion_event" ),
415422 conversion_window = metric_def .get ("conversion_window" ),
416423 offset_window = metric_def .get ("offset_window" ),
424+ cohort_event = metric_def .get ("cohort_event" ),
425+ activity_event = metric_def .get ("activity_event" ),
426+ periods = metric_def .get ("periods" ),
427+ retention_granularity = (metric_def .get ("retention_granularity" ) or metric_def .get ("granularity" ))
428+ if metric_type == "retention"
429+ else None ,
417430 window = metric_def .get ("window" ),
418431 grain_to_date = metric_def .get ("grain_to_date" ),
419432 window_expression = metric_def .get ("window_expression" ),
@@ -577,6 +590,15 @@ def _export_model(self, model: Model) -> dict:
577590 measure_def ["conversion_window" ] = measure .conversion_window
578591 if measure .offset_window :
579592 measure_def ["offset_window" ] = measure .offset_window
593+ # Retention parameters
594+ if measure .cohort_event :
595+ measure_def ["cohort_event" ] = measure .cohort_event
596+ if measure .activity_event :
597+ measure_def ["activity_event" ] = measure .activity_event
598+ if measure .periods is not None :
599+ measure_def ["periods" ] = measure .periods
600+ if measure .retention_granularity :
601+ measure_def ["retention_granularity" ] = measure .retention_granularity
580602 # Cumulative/window parameters
581603 if measure .window :
582604 measure_def ["window" ] = measure .window
@@ -658,6 +680,14 @@ def _export_metric(self, measure: Metric, graph) -> dict:
658680 result ["conversion_window" ] = measure .conversion_window
659681 if measure .offset_window :
660682 result ["offset_window" ] = measure .offset_window
683+ if measure .cohort_event :
684+ result ["cohort_event" ] = measure .cohort_event
685+ if measure .activity_event :
686+ result ["activity_event" ] = measure .activity_event
687+ if measure .periods is not None :
688+ result ["periods" ] = measure .periods
689+ if measure .retention_granularity :
690+ result ["retention_granularity" ] = measure .retention_granularity
661691 if measure .sql :
662692 result ["sql" ] = measure .sql
663693 # Auto-detect and export dependencies for derived measures
0 commit comments