From fd4950d40a3ef9a48d1b0b583adceebdacc4fa54 Mon Sep 17 00:00:00 2001 From: Horace Liu Date: Fri, 20 Dec 2024 18:46:38 -0500 Subject: [PATCH] Resolve bugs --- models/dimensions/contracts/dim_flipside_contracts.sql | 3 ++- models/dimensions/contracts/dim_flipside_near_contracts.sql | 2 +- models/dimensions/labeling/dim_all_addresses_gold.sql | 0 models/dimensions/token_types/arb_token_type.sql | 2 +- models/dimensions/token_types/avax_token_type.sql | 2 +- models/dimensions/token_types/base_token_type.sql | 2 +- models/dimensions/token_types/bsc_token_type.sql | 2 +- models/dimensions/token_types/eth_token_type.sql | 2 +- models/dimensions/token_types/opt_token_type.sql | 2 +- models/dimensions/token_types/polygon_token_type.sql | 2 +- models/staging/sui/dim_sui_contracts.sql | 2 +- 11 files changed, 11 insertions(+), 10 deletions(-) create mode 100644 models/dimensions/labeling/dim_all_addresses_gold.sql diff --git a/models/dimensions/contracts/dim_flipside_contracts.sql b/models/dimensions/contracts/dim_flipside_contracts.sql index ba1a47b5..8e16bf89 100644 --- a/models/dimensions/contracts/dim_flipside_contracts.sql +++ b/models/dimensions/contracts/dim_flipside_contracts.sql @@ -46,6 +46,7 @@ select coalesce(max_by(name, category), max(name)) as name, coalesce(max_by(namespace, category), max(namespace)) as namespace, max(sub_category) as sub_category, - max(category) as category + max(category) as category, + max(last_updated) as last_updated from flipside_contract group by address, chain diff --git a/models/dimensions/contracts/dim_flipside_near_contracts.sql b/models/dimensions/contracts/dim_flipside_near_contracts.sql index 3db6b094..e627768c 100644 --- a/models/dimensions/contracts/dim_flipside_near_contracts.sql +++ b/models/dimensions/contracts/dim_flipside_near_contracts.sql @@ -3,7 +3,7 @@ with deployed_contracts as ( select tx_signer as address, - ft.modified_timestamp + max(ft.modified_timestamp) as modified_timestamp from near_flipside.core.fact_actions_events fae join near_flipside.core.fact_transactions ft diff --git a/models/dimensions/labeling/dim_all_addresses_gold.sql b/models/dimensions/labeling/dim_all_addresses_gold.sql new file mode 100644 index 00000000..e69de29b diff --git a/models/dimensions/token_types/arb_token_type.sql b/models/dimensions/token_types/arb_token_type.sql index d78b0cf9..f5a4a876 100644 --- a/models/dimensions/token_types/arb_token_type.sql +++ b/models/dimensions/token_types/arb_token_type.sql @@ -38,7 +38,7 @@ with coalesce(l.address_name, c.name, null) name, coalesce(l.project_name, c.symbol, null) namespace, coalesce(a.token_standard, null) category, - modified_timestamp + coalesce(a.modified_timestamp, l.modified_timestamp, c.modified_timestamp, null) modified_timestamp from contract_standard a left join arbitrum_flipside.core.dim_contracts c diff --git a/models/dimensions/token_types/avax_token_type.sql b/models/dimensions/token_types/avax_token_type.sql index e4d10967..0f1b40bf 100644 --- a/models/dimensions/token_types/avax_token_type.sql +++ b/models/dimensions/token_types/avax_token_type.sql @@ -38,7 +38,7 @@ with coalesce(l.address_name, c.name, null) name, coalesce(l.project_name, c.symbol, null) namespace, coalesce(a.token_standard, null) category, - modified_timestamp + coalesce(a.modified_timestamp, l.modified_timestamp, c.modified_timestamp, null) modified_timestamp from contract_standard a left join avalanche_flipside.core.dim_contracts c diff --git a/models/dimensions/token_types/base_token_type.sql b/models/dimensions/token_types/base_token_type.sql index 82fe95c5..a6e8f0d5 100644 --- a/models/dimensions/token_types/base_token_type.sql +++ b/models/dimensions/token_types/base_token_type.sql @@ -38,7 +38,7 @@ with coalesce(l.address_name, c.name, null) name, coalesce(l.project_name, c.symbol, null) namespace, coalesce(a.token_standard, null) category, - modified_timestamp + coalesce(a.modified_timestamp, l.modified_timestamp, c.modified_timestamp, null) modified_timestamp from contract_standard a left join base_flipside.core.dim_contracts c on lower(a.address) = lower(c.address) diff --git a/models/dimensions/token_types/bsc_token_type.sql b/models/dimensions/token_types/bsc_token_type.sql index 2026693c..71dae40c 100644 --- a/models/dimensions/token_types/bsc_token_type.sql +++ b/models/dimensions/token_types/bsc_token_type.sql @@ -38,7 +38,7 @@ with coalesce(l.address_name, c.name, null) name, coalesce(l.project_name, c.symbol, null) namespace, coalesce(a.token_standard, null) category, - modified_timestamp + coalesce(a.modified_timestamp, l.modified_timestamp, c.modified_timestamp, null) modified_timestamp from contract_standard a left join bsc_flipside.core.dim_contracts c on lower(a.address) = lower(c.address) diff --git a/models/dimensions/token_types/eth_token_type.sql b/models/dimensions/token_types/eth_token_type.sql index f6300020..e6d30ca4 100644 --- a/models/dimensions/token_types/eth_token_type.sql +++ b/models/dimensions/token_types/eth_token_type.sql @@ -38,7 +38,7 @@ with coalesce(l.address_name, c.name, null) name, coalesce(l.label, c.symbol, null) namespace, coalesce(a.token_standard, null) category, - modified_timestamp + coalesce(a.modified_timestamp, l.modified_timestamp, c.modified_timestamp, null) modified_timestamp from contract_standard a left join ethereum_flipside.core.dim_contracts c diff --git a/models/dimensions/token_types/opt_token_type.sql b/models/dimensions/token_types/opt_token_type.sql index 238c36b0..e82bc3b6 100644 --- a/models/dimensions/token_types/opt_token_type.sql +++ b/models/dimensions/token_types/opt_token_type.sql @@ -38,7 +38,7 @@ with coalesce(l.address_name, c.name, null) name, coalesce(l.project_name, c.symbol, null) namespace, coalesce(a.token_standard, null) category, - modified_timestamp + coalesce(a.modified_timestamp, l.modified_timestamp, c.modified_timestamp, null) modified_timestamp from contract_standard a left join optimism_flipside.core.dim_contracts c diff --git a/models/dimensions/token_types/polygon_token_type.sql b/models/dimensions/token_types/polygon_token_type.sql index 3aeb9625..041258fd 100644 --- a/models/dimensions/token_types/polygon_token_type.sql +++ b/models/dimensions/token_types/polygon_token_type.sql @@ -37,7 +37,7 @@ with coalesce(l.address_name, c.name, null) name, coalesce(l.project_name, c.symbol, null) namespace, coalesce(a.token_standard, null) category, - modified_timestamp + coalesce(a.modified_timestamp, l.modified_timestamp, c.modified_timestamp, null) modified_timestamp from contract_standard a left join polygon_flipside.core.dim_contracts c on lower(a.address) = lower(c.address) diff --git a/models/staging/sui/dim_sui_contracts.sql b/models/staging/sui/dim_sui_contracts.sql index d52f0315..94789d6f 100644 --- a/models/staging/sui/dim_sui_contracts.sql +++ b/models/staging/sui/dim_sui_contracts.sql @@ -10,7 +10,7 @@ sui_contracts_sigma_over as ( max(category) as category, max(sub_category) as sub_category, 'sui' as chain, - timestamp as last_updated + max(timestamp) as last_updated from {{ ref("fact_sui_contracts_silver") }} as sui_contracts full join {{ source("SIGMA", "sui_overwrite_namespace") }} overwrite on sui_contracts.namespace = overwrite.sui_namespace group by package_id