SniperDistribution of Votes Count by Vote Type on Prop #82
    Updated 2022-12-11
    -- select
    -- CASE --osmosis.core.dim_vote_options
    -- WHEN vote_option = 1 THEN 'YES'
    -- WHEN vote_option = 2 THEN 'ABSTAIN'
    -- WHEN vote_option = 3 THEN 'NO WITH VETO'
    -- WHEN vote_option = 4 THEN 'NO'
    -- else 'NVOTE_OPTION_UNSPECIFIED'
    -- END as type,
    -- sum(VOTE_WEIGHT) as votes_count,
    -- count(distinct VOTER) as voters_count
    -- from osmosis.core.fact_governance_votes
    -- where proposal_id = 82
    -- and tx_status='SUCCEEDED'
    -- GROUP by 1
    with proposaltx as (
    select tx_id
    from cosmos.core.fact_msg_attributes
    where ATTRIBUTE_KEY= 'proposal_id'
    and ATTRIBUTE_VALUE= '82'
    and tx_succeeded = 'TRUE'),

    votetype as (
    select block_timestamp,
    tx_id,
    try_parse_json (attribute_value) as data,
    data:option as vote_option,
    case when vote_option = '1' then 'Yes'
    when vote_option = '2' then 'Abstain'
    when vote_option = '3' then 'No'
    when vote_option = '4' then 'No With Veto'
    end as vote_type
    from cosmos.core.fact_msg_attributes
    where ATTRIBUTE_KEY= 'option'
    and data:option is not null
    and tx_id in (select tx_id from proposaltx)
    Run a query to Download Data