Updated 2022-12-11
    with proposaltx as (
    select tx_id,
    attribute_value as Proposal_ID
    from cosmos.core.fact_msg_attributes
    where ATTRIBUTE_KEY= 'proposal_id'
    and tx_succeeded = 'TRUE'),

    depositvolume as (
    select block_timestamp,
    tx_id,
    sum (split(ATTRIBUTE_VALUE,'uatom')[0]::numeric/1e6) as Deposit_Amount
    from cosmos.core.fact_msg_attributes
    where msg_type = 'proposal_deposit'
    and attribute_key = 'amount'
    and tx_id in (select tx_id from proposaltx)
    and tx_succeeded = 'TRUE'
    group by 1,2),

    depositor as (
    select block_timestamp,
    tx_id,
    attribute_value as Depositor
    from cosmos.core.fact_msg_attributes
    where ATTRIBUTE_KEY= 'spender'
    and tx_id in (select tx_id from proposaltx)
    and tx_succeeded = 'TRUE'),

    mergetable as (
    select distinct t1.tx_id,
    t2.block_timestamp,
    Depositor,
    Deposit_Amount,
    proposal_id
    from proposaltx t1 join depositor t2 on t1.tx_id = t2.tx_id
    join depositvolume t3 on t1.tx_id = t3.tx_id)

    Run a query to Download Data