MufasaOsmosis - July 11
Updated 2022-07-11Copy Reference Fork
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
›
⌄
⌄
-- WITH msg_attributes AS (
-- SELECT attribute_value AS pool_id FROM osmosis.core.fact_msg_attributes
-- WHERE msg_type='pool_created' AND attribute_key='pool_id' AND block_timestamp > '2022-05-01 00:00:00.000'
-- ), final AS (
-- SELECT * FROM osmosis.core.fact_swaps, msg_attributes, TABLE(FLATTEN(pool_ids)) p_ids
-- WHERE p_ids.value IN (
-- msg_attributes.poo_id
-- )
-- )
-- SELECT * FROM final;
-- select * from osmosis.core.fact_swaps, table(flatten(pool_ids)) p_ids
-- where p_ids.value in (
-- select attribute_value as pool_id from osmosis.core.fact_msg_attributes where msg_type='pool_created' and attribute_key='pool_id'
-- and block_timestamp > '2022-05-01 00:00:00.000');
WITH msg_attributes AS (
SELECT ARRAY_AGG(attribute_value::INTEGER) AS a_values FROM osmosis.core.fact_msg_attributes
WHERE msg_type='pool_created' AND attribute_key='pool_id' AND block_timestamp > '2022-05-01 00:00:00.000'
ORDER BY a_values
), final AS (
SELECT * FROM osmosis.core.fact_swaps, msg_attributes
WHERE ARRAY_CONTAINS(a_values, pool_ids)
)
SELECT * FROM final;
SELECT attribute_value AS a_values FROM osmosis.core.fact_msg_attributes
WHERE msg_type='pool_created' AND attribute_key='pool_id' AND block_timestamp > '2022-05-01 00:00:00.000'
ORDER BY a_values;
-- select * from osmosis.core.fact_swaps LIMIT 10;
-- select * from osmosis.core.fact_swaps
Run a query to Download Data