mirror of
https://github.com/FlipsideCrypto/external-models.git
synced 2026-02-06 13:17:03 +00:00
AN-4298/add-abi-and-read-udfs-to-external (#55)
This commit is contained in:
parent
cdc93e86b2
commit
5411f3076b
@ -57,7 +57,7 @@ row_nos AS (
|
||||
),
|
||||
batched AS ({% for item in range(10) %}
|
||||
SELECT
|
||||
ethereum.streamline.udf_api(' GET ', api_url, PARSE_JSON(header),{}) AS resp, SYSDATE() _inserted_timestamp, collection_slug, CONCAT(collection_slug, '-', _inserted_timestamp) AS _id
|
||||
live.udf_api(' GET ', api_url, PARSE_JSON(header),{}) AS resp, SYSDATE() _inserted_timestamp, collection_slug, CONCAT(collection_slug, '-', _inserted_timestamp) AS _id
|
||||
FROM
|
||||
row_nos rn
|
||||
WHERE
|
||||
|
||||
@ -60,7 +60,7 @@ row_nos AS (
|
||||
),
|
||||
batched AS ({% for item in range(9) %}
|
||||
SELECT
|
||||
ethereum.streamline.udf_api(' GET ', api_url, PARSE_JSON(header),{}) AS resp, SYSDATE() _inserted_timestamp, collection_slug, _id
|
||||
live.udf_api(' GET ', api_url, PARSE_JSON(header),{}) AS resp, SYSDATE() _inserted_timestamp, collection_slug, _id
|
||||
FROM
|
||||
row_nos rn
|
||||
WHERE
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
WITH bridge_base AS (
|
||||
|
||||
SELECT
|
||||
ethereum.streamline.udf_api(
|
||||
live.udf_api(
|
||||
'GET','https://bridges.llama.fi/bridges?includeChains=true',{},{}
|
||||
) AS read,
|
||||
SYSDATE() AS _inserted_timestamp
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
WITH chainlist_base AS (
|
||||
|
||||
SELECT
|
||||
ethereum.streamline.udf_api(
|
||||
live.udf_api(
|
||||
'GET',
|
||||
'https://chainid.network/chains.json',{},{}
|
||||
) AS READ,
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
WITH chain_base AS (
|
||||
|
||||
SELECT
|
||||
ethereum.streamline.udf_api(
|
||||
live.udf_api(
|
||||
'GET','https://api.llama.fi/chains',{},{}
|
||||
) AS read,
|
||||
SYSDATE() AS _inserted_timestamp
|
||||
|
||||
@ -7,10 +7,10 @@
|
||||
WITH base AS (
|
||||
|
||||
SELECT
|
||||
ethereum.streamline.udf_api(
|
||||
live.udf_api(
|
||||
'GET','https://api.llama.fi/overview/dexs?excludeTotalDataChart=true&excludeTotalDataChartBreakdown=true&dataType=totalVolume',{},{}
|
||||
) AS dex_read,
|
||||
ethereum.streamline.udf_api(
|
||||
live.udf_api(
|
||||
'GET','https://api.llama.fi/overview/options?excludeTotalDataChart=true&excludeTotalDataChartBreakdown=true&dataType=totalPremiumVolume',{},{}
|
||||
) AS options_read,
|
||||
SYSDATE() AS _inserted_timestamp
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
WITH protocol_base AS (
|
||||
|
||||
SELECT
|
||||
ethereum.streamline.udf_api(
|
||||
live.udf_api(
|
||||
'GET','https://api.llama.fi/protocols',{},{}
|
||||
) AS read,
|
||||
SYSDATE() AS _inserted_timestamp
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
WITH stablecoin_base AS (
|
||||
|
||||
SELECT
|
||||
ethereum.streamline.udf_api(
|
||||
live.udf_api(
|
||||
'GET','https://stablecoins.llama.fi/stablecoins?includePrices=false',{},{}
|
||||
) AS read,
|
||||
SYSDATE() AS _inserted_timestamp
|
||||
|
||||
@ -13,7 +13,7 @@ SELECT
|
||||
bridge_id,
|
||||
bridge,
|
||||
bridge_name,
|
||||
ethereum.streamline.udf_api(
|
||||
live.udf_api(
|
||||
'GET',CONCAT('https://bridges.llama.fi/bridgevolume/all?id=',bridge_id),{},{}
|
||||
) AS read,
|
||||
SYSDATE() AS _inserted_timestamp
|
||||
|
||||
@ -12,7 +12,7 @@ WITH tvl_base AS (
|
||||
SELECT
|
||||
chain_id,
|
||||
chain,
|
||||
ethereum.streamline.udf_api(
|
||||
live.udf_api(
|
||||
'GET',CONCAT('https://api.llama.fi/charts/',chain),{},{}
|
||||
) AS read,
|
||||
SYSDATE() AS _inserted_timestamp
|
||||
|
||||
@ -13,7 +13,7 @@ SELECT
|
||||
_inserted_timestamp
|
||||
FROM (
|
||||
SELECT
|
||||
ethereum.streamline.udf_api(
|
||||
live.udf_api(
|
||||
'GET','https://api.llama.fi/overview/dexs?excludeTotalDataChart=true&excludeTotalDataChartBreakdown=true&dataType=dailyVolume',{},{}
|
||||
) AS read,
|
||||
SYSDATE() AS _inserted_timestamp
|
||||
@ -27,7 +27,7 @@ dex_base AS (
|
||||
(
|
||||
SELECT
|
||||
chain,
|
||||
ethereum.streamline.udf_api(
|
||||
live.udf_api(
|
||||
'GET',CONCAT('https://api.llama.fi/overview/dexs/',chain,'?excludeTotalDataChart=true&excludeTotalDataChartBreakdown=false&dataType=dailyVolume'),{},{}
|
||||
) AS read,
|
||||
SYSDATE() AS _inserted_timestamp
|
||||
|
||||
@ -13,7 +13,7 @@ SELECT
|
||||
_inserted_timestamp
|
||||
FROM (
|
||||
SELECT
|
||||
ethereum.streamline.udf_api(
|
||||
live.udf_api(
|
||||
'GET','https://api.llama.fi/overview/options?excludeTotalDataChart=true&excludeTotalDataChartBreakdown=true&dataType=dailyNotionalVolume',{},{}
|
||||
) AS read,
|
||||
SYSDATE() AS _inserted_timestamp
|
||||
@ -27,7 +27,7 @@ options_base AS (
|
||||
(
|
||||
SELECT
|
||||
chain,
|
||||
ethereum.streamline.udf_api(
|
||||
live.udf_api(
|
||||
'GET',CONCAT('https://api.llama.fi/overview/options/',chain,'?excludeTotalDataChart=true&excludeTotalDataChartBreakdown=false&dataType=dailyNotionalVolume'),{},{}
|
||||
) AS read,
|
||||
SYSDATE() AS _inserted_timestamp
|
||||
|
||||
@ -13,7 +13,7 @@ SELECT
|
||||
_inserted_timestamp
|
||||
FROM (
|
||||
SELECT
|
||||
ethereum.streamline.udf_api(
|
||||
live.udf_api(
|
||||
'GET','https://api.llama.fi/overview/options?excludeTotalDataChart=true&excludeTotalDataChartBreakdown=true&dataType=dailyPremiumVolume',{},{}
|
||||
) AS read,
|
||||
SYSDATE() AS _inserted_timestamp
|
||||
@ -27,7 +27,7 @@ options_base AS (
|
||||
(
|
||||
SELECT
|
||||
chain,
|
||||
ethereum.streamline.udf_api(
|
||||
live.udf_api(
|
||||
'GET',CONCAT('https://api.llama.fi/overview/options/',chain,'?excludeTotalDataChart=true&excludeTotalDataChartBreakdown=false&dataType=dailyPremiumVolume'),{},{}
|
||||
) AS read,
|
||||
SYSDATE() AS _inserted_timestamp
|
||||
|
||||
@ -13,7 +13,7 @@ SELECT
|
||||
_inserted_timestamp
|
||||
FROM (
|
||||
SELECT
|
||||
ethereum.streamline.udf_api(
|
||||
live.udf_api(
|
||||
'GET','https://api.llama.fi/overview/fees?excludeTotalDataChart=true&excludeTotalDataChartBreakdown=true&dataType=totalFees',{},{}
|
||||
) AS read,
|
||||
SYSDATE() AS _inserted_timestamp
|
||||
@ -27,7 +27,7 @@ fees_base AS (
|
||||
(
|
||||
SELECT
|
||||
chain,
|
||||
ethereum.streamline.udf_api(
|
||||
live.udf_api(
|
||||
'GET',CONCAT('https://api.llama.fi/overview/fees/',chain,'?excludeTotalDataChart=true&excludeTotalDataChartBreakdown=false&dataType=dailyFees'),{},{}
|
||||
) AS read,
|
||||
SYSDATE() AS _inserted_timestamp
|
||||
|
||||
@ -13,7 +13,7 @@ SELECT
|
||||
_inserted_timestamp
|
||||
FROM (
|
||||
SELECT
|
||||
ethereum.streamline.udf_api(
|
||||
live.udf_api(
|
||||
'GET','https://api.llama.fi/overview/fees?excludeTotalDataChart=true&excludeTotalDataChartBreakdown=true&dataType=totalRevenue',{},{}
|
||||
) AS read,
|
||||
SYSDATE() AS _inserted_timestamp
|
||||
@ -27,7 +27,7 @@ rev_base AS (
|
||||
(
|
||||
SELECT
|
||||
chain,
|
||||
ethereum.streamline.udf_api(
|
||||
live.udf_api(
|
||||
'GET',CONCAT('https://api.llama.fi/overview/fees/',chain,'?excludeTotalDataChart=true&excludeTotalDataChartBreakdown=false&dataType=dailyRevenue'),{},{}
|
||||
) AS read,
|
||||
SYSDATE() AS _inserted_timestamp
|
||||
|
||||
@ -9,13 +9,10 @@ WITH requests AS ({% for item in range(6) %}
|
||||
(
|
||||
|
||||
SELECT
|
||||
ethereum.streamline.udf_api('GET', 'https://hub.snapshot.org/graphql',{ 'apiKey': (
|
||||
SELECT
|
||||
api_key
|
||||
FROM
|
||||
{{ source('crosschain_silver', 'apis_keys') }}
|
||||
WHERE
|
||||
api_name = 'snapshot') },{ 'query':'query { proposals(orderBy: "created", orderDirection: asc,first:1000, skip: ' || {{ item * 1000 }} || ',where:{created_gte: ' || max_time_start || '}) { id space{id voting {delay quorum period type}} ipfs author created network type title body start end state votes choices scores_state scores } }' }) AS resp, SYSDATE() AS _inserted_timestamp
|
||||
live.udf_api('GET', 'https://hub.snapshot.org/graphql',{ 'apiKey':'key' },
|
||||
{ 'query':'query { proposals(orderBy: "created", orderDirection: asc,first:1000, skip: ' || {{ item * 1000 }} || ',where:{created_gte: ' || max_time_start || '}) { id space{id voting {delay quorum period type}} ipfs author created network type title body start end state votes choices scores_state scores } }' }
|
||||
,'Vault/prod/external/snapshot') AS resp,
|
||||
SYSDATE() AS _inserted_timestamp
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
|
||||
@ -10,13 +10,7 @@ WITH requests AS ({% for item in range(6) %}
|
||||
(
|
||||
|
||||
SELECT
|
||||
ethereum.streamline.udf_api('GET', 'https://hub.snapshot.org/graphql',{ 'apiKey': (
|
||||
SELECT
|
||||
api_key
|
||||
FROM
|
||||
{{ source('crosschain_silver', 'apis_keys') }}
|
||||
WHERE
|
||||
api_name = 'snapshot') },{ 'query': 'query { spaces(orderBy: "created", orderDirection: desc, first: 1000, skip: ' || {{ item * 1000 }} || ') { id name about network symbol admins members categories domain private treasuries { address name network } verified } }' }) AS resp, SYSDATE() AS _inserted_timestamp) {% if not loop.last %}
|
||||
live.udf_api('GET', 'https://hub.snapshot.org/graphql',{ 'apiKey':'key' },{ 'query': 'query { spaces(orderBy: "created", orderDirection: desc, first: 1000, skip: ' || {{ item * 1000 }} || ') { id name about network symbol admins members categories domain private treasuries { address name network } verified } }' },'Vault/prod/external/snapshot') AS resp, SYSDATE() AS _inserted_timestamp) {% if not loop.last %}
|
||||
UNION ALL
|
||||
{% endif %}
|
||||
{% endfor %}),
|
||||
|
||||
@ -10,13 +10,7 @@ WITH initial_request AS ({% for item in range(6) %}
|
||||
(
|
||||
|
||||
SELECT
|
||||
ethereum.streamline.udf_api('GET', 'https://hub.snapshot.org/graphql',{ 'apiKey': (
|
||||
SELECT
|
||||
api_key
|
||||
FROM
|
||||
{{ source('crosschain_silver', 'apis_keys') }}
|
||||
WHERE
|
||||
api_name = 'snapshot') },{ 'query': 'query { users(orderBy: "created", orderDirection: asc, first: 1000, skip: ' || {{ item * 1000 }} || ', where:{created_gte: ' || max_time_start || '}) { id name about avatar ipfs created } }' }) AS resp, SYSDATE() AS _inserted_timestamp
|
||||
live.udf_api('GET', 'https://hub.snapshot.org/graphql',{ 'apiKey':'key' },{ 'query': 'query { users(orderBy: "created", orderDirection: asc, first: 1000, skip: ' || {{ item * 1000 }} || ', where:{created_gte: ' || max_time_start || '}) { id name about avatar ipfs created } }' },'Vault/prod/external/snapshot') AS resp, SYSDATE() AS _inserted_timestamp
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
@ -60,7 +54,7 @@ users_initial AS (
|
||||
final_request AS ({% for item in range(6) %}
|
||||
(
|
||||
SELECT
|
||||
ethereum.streamline.udf_api('GET', 'https://hub.snapshot.org/graphql',{ 'apiKey': (
|
||||
live.udf_api('GET', 'https://hub.snapshot.org/graphql',{ 'apiKey': (
|
||||
SELECT
|
||||
api_key
|
||||
FROM
|
||||
|
||||
@ -9,13 +9,7 @@ WITH initial_votes_request AS ({% for item in range(6) %}
|
||||
(
|
||||
|
||||
SELECT
|
||||
ethereum.streamline.udf_api('GET', 'https://hub.snapshot.org/graphql',{ 'apiKey': (
|
||||
SELECT
|
||||
api_key
|
||||
FROM
|
||||
{{ source('crosschain_silver', 'apis_keys') }}
|
||||
WHERE
|
||||
api_name = 'snapshot') },{ 'query': 'query { votes(orderBy: "created", orderDirection: asc, first: 1000, skip: ' || {{ item * 1000 }} || ', where:{created_gte: ' || max_time_start || ',created_lt: ' || max_time_end || '}) { id proposal{id} ipfs voter created choice vp } }' }) AS resp, SYSDATE() AS _inserted_timestamp
|
||||
live.udf_api('GET', 'https://hub.snapshot.org/graphql',{ 'apiKey':'key' },{ 'query': 'query { votes(orderBy: "created", orderDirection: asc, first: 1000, skip: ' || {{ item * 1000 }} || ', where:{created_gte: ' || max_time_start || ',created_lt: ' || max_time_end || '}) { id proposal{id} ipfs voter created choice vp } }' },'Vault/prod/external/snapshot') AS resp, SYSDATE() AS _inserted_timestamp
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
@ -61,7 +55,7 @@ votes_initial AS (
|
||||
final_votes_request AS ({% for item in range(6) %}
|
||||
(
|
||||
SELECT
|
||||
ethereum.streamline.udf_api('GET', 'https://hub.snapshot.org/graphql',{ 'apiKey': (
|
||||
live.udf_api('GET', 'https://hub.snapshot.org/graphql',{ 'apiKey': (
|
||||
SELECT
|
||||
api_key
|
||||
FROM
|
||||
|
||||
@ -6,4 +6,4 @@ packages:
|
||||
- package: dbt-labs/dbt_utils
|
||||
version: 1.0.0
|
||||
- git: https://github.com/FlipsideCrypto/fsc-utils.git
|
||||
revision: v1.4.1
|
||||
revision: v1.21.7
|
||||
Loading…
Reference in New Issue
Block a user