forgashNEAR Post Count - JSON Parsing
Updated 2023-09-04
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 main_posts as (
select block_timestamp,
tx_hash,
block_id as og_post_id,
block_id as current_post_id,
signer_id,
post_text
from near.social.fact_posts
where signer_id = 'nfcommunity.near'
)
,
reply_posts as (
select block_timestamp,
tx_hash,
try_parse_json(node_data:comment):item:blockHeight::INT as og_post_id,
block_id as current_post_id,
signer_id,
try_parse_json(node_data:comment):text::STRING as post_text
from near.social.fact_decoded_actions
where (node_data LIKE '%nfcommunity.near%'
or signer_id = 'nfcommunity.near')
and node = 'post'
and og_post_id is not null
),
all_posts as (
select * from main_posts
UNION ALL
select * from reply_posts
),
likes as (
select *,
try_parse_json(node_data:like) as json_data,
json_data:key:blockHeight::INT as og_post_id,
Run a query to Download Data