KaskoazulNode Churning Events
    Updated 2022-05-05
    with churn_out as (
    select block_timestamp::date as fecha,
    block_id,
    concat_ws (' to ', former_status, current_status) as change,
    case change
    when 'Active to Standby' then 'Churn out'
    when 'Active to Disabled' then 'Churn out'
    when 'Ready to Active' then 'Churn in'
    else 'pff'
    end as churn,
    count (node_address) as churning_events,
    block_id - lag (block_id) over (partition by change order by fecha) as block_diff
    from thorchain.update_node_account_status_events
    where fecha >= '{{Timeframe}}'
    and churn = 'Churn out'
    group by 1,2,3,4
    order by 1 desc
    ),

    churn_in as (
    select block_timestamp::date as fecha,
    block_id,
    concat_ws (' to ', former_status, current_status) as change,
    case change
    when 'Active to Standby' then 'Churn out'
    when 'Active to Disabled' then 'Churn out'
    when 'Ready to Active' then 'Churn in'
    else 'pff'
    end as churn,
    count (node_address) as churning_events,
    block_id - lag (block_id) over (partition by change order by fecha) as block_diff
    from thorchain.update_node_account_status_events
    where fecha >= '{{Timeframe}}'
    and churn = 'Churn in'
    group by 1,2,3,4
    order by 1 desc
    Run a query to Download Data