jenwitteng commented on issue #37114:
URL: https://github.com/apache/superset/issues/37114#issuecomment-3748538046

   **Case /r/n**
   writing cache
   
   > query_dict={'apply_fetch_values_predicate': False, 'columns': 
[{'timeGrain': 'P1M', 'columnType': 'BASE_AXIS', 'sqlExpression': 
'booking_datetime_cast', 'label': 'booking_datetime_cast', 'expressionType': 
'SQL'}], 'extras': {'time_grain_sqla': 'P1M', 'having': '', 'where': ''}, 
'filter': [{'col': 'whitelabel_name', 'op': 'IN', 'val': ['RMNectar']}, {'col': 
'booking_datetime_cast', 'op': 'TEMPORAL_RANGE', 'val': 
'DATEADD(DATETIME("now"), -7, day) : now'}], 'from_dttm': 
datetime.datetime(2026, 1, 6, 9, 1, 55), 'granularity': None, 
'inner_from_dttm': None, 'inner_to_dttm': None, 'is_rowcount': False, 
'is_timeseries': False, 'metrics': [{'aggregate': None, 'column': None, 
'datasourceWarning': False, 'expressionType': 'SQL', 'hasCustomLabel': True, 
'label': '< 16% Spread', 'optionName': 'metric_d7ocbaa3aq_k1i0msjgad', 
'sqlExpression': "SUM(CASE \r\n      WHEN cast(original_total_spread_percentage 
as float) < 0.16\r\n      THEN CASE\r\n            WHEN tbl_source = 'PPA' THEN 
hotel_no
 _of_room\r\n            WHEN tbl_source = 'TR' THEN 1\r\n            END\r\n   
 END)"}, {'aggregate': None, 'column': None, 'datasourceWarning': False, 
'expressionType': 'SQL', 'hasCustomLabel': True, 'label': '16% - 20% Spread', 
'optionName': 'metric_wqmh9wx1z2_ymlki2up3dn', 'sqlExpression': "SUM(CASE \r\n  
    WHEN cast(original_total_spread_percentage as float) >= 0.16\r\n        AND 
cast(original_total_spread_percentage as float) < 0.2\r\n      THEN CASE\r\n    
        WHEN tbl_source = 'PPA' THEN hotel_no_of_room\r\n            WHEN 
tbl_source = 'TR' THEN 1\r\n            END\r\n    END)"}, {'aggregate': None, 
'column': None, 'datasourceWarning': False, 'expressionType': 'SQL', 
'hasCustomLabel': True, 'label': '20% - 25% Spread', 'optionName': 
'metric_5egn3fc8zja_1b16x3da4md', 'sqlExpression': "SUM(CASE \r\n      WHEN 
cast(original_total_spread_percentage as float) >= 0.20\r\n        AND 
cast(original_total_spread_percentage as float) < 0.25\r\n      THEN CASE\r\n   
         WH
 EN tbl_source = 'PPA' THEN hotel_no_of_room\r\n            WHEN tbl_source = 
'TR' THEN 1\r\n            END\r\n    END)"}, {'aggregate': None, 'column': 
None, 'datasourceWarning': False, 'expressionType': 'SQL', 'hasCustomLabel': 
True, 'label': '25% - 30% Spread', 'optionName': 
'metric_loo72lfax59_rta69r6ml5', 'sqlExpression': "SUM(CASE \r\n      WHEN 
cast(original_total_spread_percentage as float) >= 0.25\r\n        AND 
cast(original_total_spread_percentage as float) < 0.30\r\n      THEN CASE\r\n   
         WHEN tbl_source = 'PPA' THEN hotel_no_of_room\r\n            WHEN 
tbl_source = 'TR' THEN 1\r\n            END\r\n    END)"}, {'aggregate': None, 
'column': None, 'datasourceWarning': False, 'expressionType': 'SQL', 
'hasCustomLabel': True, 'label': '>= 30% Spread', 'optionName': 
'metric_46nrvjqbi3t_cnxe56gcyl8', 'sqlExpression': "SUM(CASE \r\n      WHEN 
cast(original_total_spread_percentage as float) >= 0.30\r\n      THEN CASE\r\n  
          WHEN tbl_source = 'PPA' THEN hotel_no_o
 f_room\r\n            WHEN tbl_source = 'TR' THEN 1\r\n            END\r\n    
END)"}], 'order_desc': True, 'orderby': [({'aggregate': None, 'column': None, 
'datasourceWarning': False, 'expressionType': 'SQL', 'hasCustomLabel': True, 
'label': '< 16% Spread', 'optionName': 'metric_d7ocbaa3aq_k1i0msjgad', 
'sqlExpression': "SUM(CASE \r\n      WHEN cast(original_total_spread_percentage 
as float) < 0.16\r\n      THEN CASE\r\n            WHEN tbl_source = 'PPA' THEN 
hotel_no_of_room\r\n            WHEN tbl_source = 'TR' THEN 1\r\n            
END\r\n    END)"}, False)], 'row_limit': 10000, 'row_offset': 0, 
'series_columns': [], 'series_limit': 0, 'series_limit_metric': None, 
'to_dttm': datetime.datetime(2026, 1, 13, 9, 1, 55), 'time_shift': None, 
'conditional_formatting': None, 'comments': None}
   
   reading cache
   
   > query_dict={'apply_fetch_values_predicate': False, 'columns': 
[{'timeGrain': 'P1M', 'columnType': 'BASE_AXIS', 'sqlExpression': 
'booking_datetime_cast', 'label': 'booking_datetime_cast', 'expressionType': 
'SQL'}], 'extras': {'where': '', 'having': '', 'time_grain_sqla': 'P1M'}, 
'filter': [{'val': ['RMNectar'], 'op': 'IN', 'col': 'whitelabel_name'}, {'val': 
'DATEADD(DATETIME("now"), -7, day) : now', 'op': 'TEMPORAL_RANGE', 'col': 
'booking_datetime_cast'}], 'from_dttm': datetime.datetime(2026, 1, 6, 9, 2, 8), 
'granularity': None, 'inner_from_dttm': None, 'inner_to_dttm': None, 
'is_rowcount': False, 'is_timeseries': False, 'metrics': [{'aggregate': None, 
'column': None, 'datasourceWarning': False, 'expressionType': 'SQL', 
'hasCustomLabel': True, 'label': '< 16% Spread', 'optionName': 
'metric_d7ocbaa3aq_k1i0msjgad', 'sqlExpression': "SUM(CASE \r\n      WHEN 
cast(original_total_spread_percentage as float) < 0.16\r\n      THEN CASE\r\n   
         WHEN tbl_source = 'PPA' THEN hotel_no_
 of_room\r\n            WHEN tbl_source = 'TR' THEN 1\r\n            END\r\n    
END)"}, {'aggregate': None, 'column': None, 'datasourceWarning': False, 
'expressionType': 'SQL', 'hasCustomLabel': True, 'label': '16% - 20% Spread', 
'optionName': 'metric_wqmh9wx1z2_ymlki2up3dn', 'sqlExpression': "SUM(CASE \r\n  
    WHEN cast(original_total_spread_percentage as float) >= 0.16\r\n        AND 
cast(original_total_spread_percentage as float) < 0.2\r\n      THEN CASE\r\n    
        WHEN tbl_source = 'PPA' THEN hotel_no_of_room\r\n            WHEN 
tbl_source = 'TR' THEN 1\r\n            END\r\n    END)"}, {'aggregate': None, 
'column': None, 'datasourceWarning': False, 'expressionType': 'SQL', 
'hasCustomLabel': True, 'label': '20% - 25% Spread', 'optionName': 
'metric_5egn3fc8zja_1b16x3da4md', 'sqlExpression': "SUM(CASE \r\n      WHEN 
cast(original_total_spread_percentage as float) >= 0.20\r\n        AND 
cast(original_total_spread_percentage as float) < 0.25\r\n      THEN CASE\r\n   
         WHE
 N tbl_source = 'PPA' THEN hotel_no_of_room\r\n            WHEN tbl_source = 
'TR' THEN 1\r\n            END\r\n    END)"}, {'aggregate': None, 'column': 
None, 'datasourceWarning': False, 'expressionType': 'SQL', 'hasCustomLabel': 
True, 'label': '25% - 30% Spread', 'optionName': 
'metric_loo72lfax59_rta69r6ml5', 'sqlExpression': "SUM(CASE \r\n      WHEN 
cast(original_total_spread_percentage as float) >= 0.25\r\n        AND 
cast(original_total_spread_percentage as float) < 0.30\r\n      THEN CASE\r\n   
         WHEN tbl_source = 'PPA' THEN hotel_no_of_room\r\n            WHEN 
tbl_source = 'TR' THEN 1\r\n            END\r\n    END)"}, {'aggregate': None, 
'column': None, 'datasourceWarning': False, 'expressionType': 'SQL', 
'hasCustomLabel': True, 'label': '>= 30% Spread', 'optionName': 
'metric_46nrvjqbi3t_cnxe56gcyl8', 'sqlExpression': "SUM(CASE \r\n      WHEN 
cast(original_total_spread_percentage as float) >= 0.30\r\n      THEN CASE\r\n  
          WHEN tbl_source = 'PPA' THEN hotel_no_of
 _room\r\n            WHEN tbl_source = 'TR' THEN 1\r\n            END\r\n    
END)"}], 'order_desc': True, 'orderby': [({'aggregate': None, 'column': None, 
'datasourceWarning': False, 'expressionType': 'SQL', 'hasCustomLabel': True, 
'label': '< 16% Spread', 'optionName': 'metric_d7ocbaa3aq_k1i0msjgad', 
'sqlExpression': "SUM(CASE \n      WHEN cast(original_total_spread_percentage 
as float) < 0.16\n      THEN CASE\n            WHEN tbl_source = 'PPA' THEN 
hotel_no_of_room\n            WHEN tbl_source = 'TR' THEN 1\n            END\n  
  END)"}, False)], 'row_limit': 10000, 'row_offset': 0, 'series_columns': [], 
'series_limit': 0, 'series_limit_metric': None, 'to_dttm': 
datetime.datetime(2026, 1, 13, 9, 2, 8), 'time_shift': None, 
'conditional_formatting': None, 'comments': None}
   
   **case jinja template**
   writing cache
   
   > query_dict={'apply_fetch_values_predicate': False, 'columns': 
[{'timeGrain': 'P3M', 'columnType': 'BASE_AXIS', 'sqlExpression': 
'merge_request_merged_at', 'label': 'merge_request_merged_at', 
'expressionType': 'SQL'}], 'extras': {'having': '', 'where': '', 
'time_grain_sqla': 'P3M'}, 'filter': [{'val': ['Yes'], 'op': 'IN', 'col': 
'yes_no_condition'}, {'val': ['No'], 'op': 'IN', 'col': 'is_intern_included'}, 
{'val': ['No'], 'op': 'IN', 'col': 'is_freezing_period_included'}, {'val': 
['No'], 'op': 'IN', 'col': 'is_inactivity_included'}, {'val': [False], 'op': 
'IN', 'col': 'true_false_bool_condition'}, {'val': 75, 'op': '==', 'col': 
'percentile'}, {'val': ['System owner'], 'op': 'IN', 'col': 'calculated_by'}, 
{'val': 'datetrunc(dateadd(datetime("today"), -1, quarter), quarter) : 
datetime("today")', 'op': 'TEMPORAL_RANGE', 'col': 'merge_request_merged_at'}], 
'from_dttm': datetime.datetime(2025, 10, 1, 0, 0), 'granularity': None, 
'inner_from_dttm': None, 'inner_to_dttm': None, 'is_rowco
 unt': False, 'is_timeseries': False, 'metrics': [{'aggregate': None, 'column': 
None, 'datasourceWarning': True, 'expressionType': 'SQL', 'hasCustomLabel': 
True, 'label': 'MLTC', 'optionName': 'metric_25y7eu1dboh_x7xp5sc9x2', 
'sqlExpression': "{% set no_of_mrs = filter_values('percentile')[0] 
%}\n\nAPPROXIMATE_PERCENTILE((office_hour_mltc/(60*9)) USING PARAMETERS 
percentile={{ no_of_mrs }}/100)"}], 'order_desc': True, 'orderby': 
[({'aggregate': None, 'column': None, 'datasourceWarning': True, 
'expressionType': 'SQL', 'hasCustomLabel': True, 'label': 'MLTC', 'optionName': 
'metric_25y7eu1dboh_x7xp5sc9x2', 'sqlExpression': "{% set no_of_mrs = 
filter_values('percentile')[0] 
%}\n\nAPPROXIMATE_PERCENTILE((office_hour_mltc/(60*9)) USING PARAMETERS 
percentile={{ no_of_mrs }}/100)"}, False)], 'row_limit': 10000, 'row_offset': 
0, 'series_columns': [], 'series_limit': 0, 'series_limit_metric': None, 
'to_dttm': datetime.datetime(2026, 1, 14, 0, 0), 'time_shift': None, 
'conditional_formatting': N
 one, 'comments': None}
   
   reading cache
   
   > query_dict={'apply_fetch_values_predicate': False, 'columns': 
[{'timeGrain': 'P3M', 'columnType': 'BASE_AXIS', 'sqlExpression': 
'merge_request_merged_at', 'label': 'merge_request_merged_at', 
'expressionType': 'SQL'}], 'extras': {'time_grain_sqla': 'P3M', 'where': '', 
'having': ''}, 'filter': [{'val': ['Yes'], 'col': 'yes_no_condition', 'op': 
'IN'}, {'val': ['No'], 'col': 'is_intern_included', 'op': 'IN'}, {'val': 
['No'], 'col': 'is_freezing_period_included', 'op': 'IN'}, {'val': ['No'], 
'col': 'is_inactivity_included', 'op': 'IN'}, {'val': [False], 'col': 
'true_false_bool_condition', 'op': 'IN'}, {'val': 75, 'col': 'percentile', 
'op': '=='}, {'val': ['System owner'], 'col': 'calculated_by', 'op': 'IN'}, 
{'val': 'datetrunc(dateadd(datetime("today"), -1, quarter), quarter) : 
datetime("today")', 'col': 'merge_request_merged_at', 'op': 'TEMPORAL_RANGE'}], 
'from_dttm': datetime.datetime(2025, 10, 1, 0, 0), 'granularity': None, 
'inner_from_dttm': None, 'inner_to_dttm': None, 'is_rowco
 unt': False, 'is_timeseries': False, 'metrics': [{'aggregate': None, 'column': 
None, 'datasourceWarning': True, 'expressionType': 'SQL', 'hasCustomLabel': 
True, 'label': 'MLTC', 'optionName': 'metric_25y7eu1dboh_x7xp5sc9x2', 
'sqlExpression': "{% set no_of_mrs = filter_values('percentile')[0] 
%}\n\nAPPROXIMATE_PERCENTILE((office_hour_mltc/(60*9)) USING PARAMETERS 
percentile={{ no_of_mrs }}/100)"}], 'order_desc': True, 'orderby': 
[({'aggregate': None, 'column': None, 'datasourceWarning': True, 
'expressionType': 'SQL', 'hasCustomLabel': True, 'label': 'MLTC', 'optionName': 
'metric_25y7eu1dboh_x7xp5sc9x2', 'sqlExpression': 
'\n\nAPPROXIMATE_PERCENTILE((office_hour_mltc/(60*9)) USING PARAMETERS 
percentile=75/100)'}, False)], 'row_limit': 10000, 'row_offset': 0, 
'series_columns': [], 'series_limit': 0, 'series_limit_metric': None, 
'to_dttm': datetime.datetime(2026, 1, 14, 0, 0), 'time_shift': None, 
'conditional_formatting': None, 'comments': None}


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to