mirror of
https://github.com/FlipsideCrypto/near-models.git
synced 2026-02-06 11:26:52 +00:00
seed tokenlist
This commit is contained in:
parent
cd0a727d1a
commit
c7d93e130d
File diff suppressed because one or more lines are too long
2468
data/seeds__ft_tokenlist.csv
Normal file
2468
data/seeds__ft_tokenlist.csv
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,3 @@
|
||||
-- depends on: {{ ref('seeds__ft_token_details_final')}}
|
||||
-- depends on: {{ ref('bronze__nearblocks_ft_metadata')}}
|
||||
|
||||
{{ config(
|
||||
@ -11,15 +10,6 @@
|
||||
|
||||
|
||||
WITH bronze AS (
|
||||
{% if var('NEAR_MIGRATE_ARCHIVE', false) %}
|
||||
|
||||
SELECT
|
||||
contract_address,
|
||||
TRY_PARSE_JSON(DATA) AS DATA
|
||||
FROM
|
||||
{{ ref('seeds__ft_token_details_final')}}
|
||||
|
||||
{% else %}
|
||||
|
||||
SELECT
|
||||
VALUE :CONTRACT_ADDRESS :: STRING AS contract_address,
|
||||
@ -38,8 +28,6 @@ WITH bronze AS (
|
||||
{{ this }}
|
||||
)
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
),
|
||||
flatten_results AS (
|
||||
SELECT
|
||||
|
||||
@ -8,20 +8,6 @@
|
||||
tags = ['streamline_non_core']
|
||||
) }}
|
||||
|
||||
{% if var('NEAR_MIGRATE_ARCHIVE', false) %}
|
||||
|
||||
SELECT
|
||||
contract_address,
|
||||
DATE_PART('EPOCH', inserted_timestamp) :: INTEGER AS partition_key,
|
||||
inserted_timestamp AS _inserted_timestamp,
|
||||
contract_address AS nearblocks_ft_complete_id,
|
||||
SYSDATE() AS inserted_timestamp,
|
||||
SYSDATE() AS modified_timestamp,
|
||||
'{{ invocation_id }}' AS _invocation_id
|
||||
FROM
|
||||
{{ ref('seeds__ft_token_details_final')}}
|
||||
|
||||
{% else %}
|
||||
SELECT
|
||||
VALUE :CONTRACT_ADDRESS :: STRING AS contract_address,
|
||||
partition_key,
|
||||
@ -47,6 +33,5 @@ AND
|
||||
'1900-01-01' :: timestamp_ntz
|
||||
)
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
qualify(row_number() over (partition by contract_address order by _inserted_timestamp desc)) = 1
|
||||
|
||||
@ -34,7 +34,10 @@ SELECT
|
||||
{{ target.database }}.live.udf_api(
|
||||
'GET',
|
||||
'{Service}fts/' || contract_address,
|
||||
{},
|
||||
{
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': 'Bearer ' || '{Authentication}'
|
||||
},
|
||||
{},
|
||||
'Vault/prod/near/nearblocks'
|
||||
) AS request
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
WITH ft_transfers AS (
|
||||
|
||||
SELECT
|
||||
DISTINCT receipt_receiver_id AS contract_address
|
||||
DISTINCT lower(receipt_receiver_id) AS contract_address
|
||||
FROM
|
||||
{{ ref('core__ez_actions') }}
|
||||
WHERE
|
||||
@ -24,8 +24,18 @@ AND modified_timestamp >= (
|
||||
COALESCE(MAX(modified_timestamp), '1970-01-01')
|
||||
FROM
|
||||
{{ this }})
|
||||
{% endif %}
|
||||
)
|
||||
{% if not is_incremental() %}
|
||||
{% do log('Is FR, loading from seed file', info=true) %}
|
||||
,
|
||||
tokenlist_seed AS (
|
||||
SELECT
|
||||
lower(contract_address) AS contract_address
|
||||
FROM
|
||||
{{ ref('seeds__ft_tokenlist') }}
|
||||
)
|
||||
{% endif %}
|
||||
)
|
||||
SELECT
|
||||
contract_address,
|
||||
{{ dbt_utils.generate_surrogate_key(
|
||||
@ -37,8 +47,20 @@ SELECT
|
||||
FROM
|
||||
ft_transfers
|
||||
|
||||
qualify(ROW_NUMBER() over (
|
||||
PARTITION BY contract_address
|
||||
ORDER BY
|
||||
modified_timestamp asc
|
||||
) = 1)
|
||||
{% if not is_incremental() %}
|
||||
UNION
|
||||
SELECT
|
||||
contract_address,
|
||||
{{ dbt_utils.generate_surrogate_key(
|
||||
['contract_address']
|
||||
) }} AS ft_tokenlist_id,
|
||||
SYSDATE() AS inserted_timestamp,
|
||||
SYSDATE() AS modified_timestamp,
|
||||
'{{ invocation_id }}' AS _invocation_id
|
||||
FROM
|
||||
tokenlist_seed
|
||||
{% endif %}
|
||||
|
||||
qualify(ROW_NUMBER() over (PARTITION BY contract_address
|
||||
ORDER BY
|
||||
modified_timestamp ASC) = 1)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user