Updated 2022-07-17
    with unstakes as
    (
    (
    select block_timestamp,TX_ID,currency,decimal,DELEGATOR_ADDRESS,VALIDATOR_ADDRESS,'normal_unstake' as "stake" from osmosis.core.fact_staking
    where action='undelegate'
    and TX_STATUS='SUCCEEDED'
    )
    union
    (
    select block_timestamp,TX_ID,currency,decimal,DELEGATOR_ADDRESS,VALIDATOR_ADDRESS,'super_unstake' as "stake" from osmosis.core.fact_superfluid_staking
    where action='Superfluiddelegate'
    )
    ),
    transfers as (
    select ft.block_timestamp,ft.blockchain,ft.chain_id,ft.tx_id,ft.sender,ft.transfer_type,'transfer' as act from osmosis.core.fact_transfers ft inner join unstakes un
    on (un.delegator_address=ft.sender and ft.block_timestamp>un.block_timestamp)
    where ft.tx_status='SUCCEEDED'

    ),
    swaps as (
    select sw.block_timestamp,sw.blockchain,sw.chain_id,sw.tx_id,sw.trader,sw.to_currency,'swap' as act from osmosis.core.fact_swaps sw inner join unstakes un
    on (un.delegator_address=sw.trader and sw.block_timestamp>un.block_timestamp)
    where from_currency='uosmo' and sw.tx_status='SUCCEEDED'

    ),
    lp as (
    select lp.block_timestamp,lp.blockchain,lp.chain_id,lp.tx_id,lp.liquidity_provider_address,lp.currency,'provide liquidity' as act from osmosis.core.fact_liquidity_provider_actions lp inner join unstakes un
    on (un.delegator_address=lp.LIQUIDITY_PROVIDER_ADDRESS and lp.block_timestamp>un.block_timestamp)
    where lp.currency ilike '%osmo%' and action='pool_joined'
    and lp.tx_status='SUCCEEDED'
    ),
    redelegate as (
    select fs.block_timestamp,fs.blockchain,fs.chain_id,fs.tx_id,fs.delegator_address,fs.action,'redelegate' as act from osmosis.core.fact_staking fs inner join unstakes un
    on (un.delegator_address=fs.DELEGATOR_ADDRESS and fs.block_timestamp>un.block_timestamp)
    Run a query to Download Data