KaskoazulRealms DAO last proposals
    Updated 2022-08-17
    with raw as (
    select case realms_id
    when 'DPiH3H3c7t47BMxqTxLsuPQpEC6Kne8GA9VXbxpnZxFE' then 'Mango'
    when 'By2sVGZXwfQq6rAiAM3rNPJ9iQfb5e2QhnF4YjJ4Bip' then 'Grape'
    when 'FiG6YoqWnVzUmxFNukcRVXZC51HvLr6mts8nxcm7ScR8' then 'PSY Finance'
    when '7sf3tcWm58vhtkJMwuw2P3T6UBX7UE5VKxPMnXJUZ1Hn' then 'Solend'
    when 'B1CxhV1khhj7n5mi5hebbivesqH9mvXr5Hfh2nD2UCh6' then 'MonkeDAO' --MonkeDAO Vote ignored
    when '2sEcHwzsNBwNoTM1yAXjtF1HTMQKUAXf8ivtdpSpo9Fv' then 'Metaplex' --Foundation
    --when 'Cdui9Va8XnKVng3VGZXcfBFF6XSxbqSi2XruMc7iu817' then 'Metaplex' --Genesis
    when '78TbURwqF71Qk4w1Xp6Jd2gaoQb6EC7yKBh5xDJmq6qh' then 'Jet'
    when '3MMDxjv1SzEFQDKryT7csAvaydYtrgMAc3L9xL9CVLCg' then 'Serum'
    when '6orGiJYGXYk9GT2NFoTv2ZMYpA6asMieAqdek4YRH2Dn' then 'The Imperium of Rain'
    when '7oB84bSuxv9AH1iRdMp5nFLwpQApv8Yo9s1gGmDkHtSP' then 'Synthetify'
    else NULL
    end as DAO_name,
    block_timestamp,
    block_id,
    tx_id,
    voter,
    voter_account,
    proposal,
    vote_choice,
    vote_rank,
    vote_weight
    from solana.core.fact_proposal_votes
    where governance_platform = 'realms'
    and succeeded = TRUE
    and DAO_name is not NULL
    ),


    raw_rank as (
    select DAO_name,
    proposal,
    max (block_timestamp) as last_proposal,
    rank () over (partition by DAO_name order by last_proposal desc) as rank
    Run a query to Download Data