get token metadata macro (#150)

* get token metadata macro

* pr fix

* process 100 at a time
This commit is contained in:
desmond-hui 2022-11-04 11:19:03 -07:00 committed by GitHub
parent 5b3c74eb60
commit ed2ea44948
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2207 additions and 0 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,28 @@
{% macro get_token_metadata() %}
{% set query %}
create schema if not exists bronze_api;
create table if not exists bronze_api.token_metadata(address string, data variant, _inserted_timestamp timestamp_ntz);
{% endset %}
{% do run_query(query) %}
{% set query %}
insert into bronze_api.token_metadata(address, data, _inserted_timestamp)
with base as (
select address
from {{ ref('seed__missing_token_metadata') }}
except
select address
from bronze_api.token_metadata
limit 100
)
select
address,
ethereum.streamline.udf_api('GET', concat('https://public-api.solscan.io/token/meta?tokenAddress=',address), {}, {}) as resp,
sysdate()
from base
;
{% endset %}
{% do run_query(query) %}
{% endmacro %}