cybergenlabDune Extract Tuto
Updated 2024-12-30
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
›
⌄
⌄
--LiveQuery API call
with dune_data AS (
SELECT livequery.live.udf_api(
'https://api.dune.com/api/v1/query/4500341/results?api_key={key1}',
'dune_key'
) AS response
)
, flatten_dune_data AS (
SELECT * FROM dune_data, table(flatten(response, ''))
)
--Parse the initial response to only save data from the Dune Table
, data as (
SELECT
value:result:rows as table_data
FROM flatten_dune_data
)
--Final table
SELECT
vm.value:day::date as date,
vm.value:symbol::string as symbol,
vm.value:price::numeric as price
from
data
, LATERAL FLATTEN(table_data) vm
order by 1
/*
SELECT
vm.value:issuer::string as issuer,
vm.value:address::string as address,
QueryRunArchived: QueryRun has been archived