From 05410e5e322fa980d68e2633ef9a74c0c971beda Mon Sep 17 00:00:00 2001 From: Jack Forgash <58153492+forgxyz@users.noreply.github.com> Date: Mon, 11 Dec 2023 12:47:56 -0700 Subject: [PATCH] upd coalesce on ts --- models/gold/atlas/atlas__ez_nft_contract_metrics.sql | 4 ++-- .../gold/atlas/atlas__ez_nft_contract_metrics_daily.sql | 4 ++-- models/gold/atlas/atlas__ez_supply.sql | 4 ++-- models/gold/atlas/atlas__fact_accounts_created.sql | 4 ++-- models/gold/atlas/atlas__fact_maas.sql | 4 ++-- models/gold/atlas/atlas__fact_nft_monthly_txs.sql | 4 ++-- models/gold/core/core__dim_address_labels.sql | 4 ++-- models/gold/core/core__dim_ft_contract_metadata.sql | 4 ++-- models/gold/core/core__dim_token_labels.sql | 8 ++++---- models/gold/core/core__fact_actions_events.sql | 4 ++-- .../core/core__fact_actions_events_function_call.sql | 4 ++-- models/gold/core/core__fact_blocks.sql | 4 ++-- models/gold/core/core__fact_developer_activity.sql | 4 ++-- models/gold/core/core__fact_logs.sql | 4 ++-- models/gold/core/core__fact_receipts.sql | 4 ++-- models/gold/core/core__fact_transactions.sql | 4 ++-- models/gold/core/core__fact_transfers.sql | 4 ++-- models/gold/defi/defi__ez_dex_swaps.sql | 9 +++++---- models/gold/governance/gov__dim_staking_pools.sql | 4 ++-- models/gold/governance/gov__fact_lockup_actions.sql | 4 ++-- models/gold/governance/gov__fact_staking_actions.sql | 4 ++-- .../gold/governance/gov__fact_staking_pool_balances.sql | 4 ++-- .../governance/gov__fact_staking_pool_daily_balances.sql | 4 ++-- models/gold/horizon/horizon__fact_decoded_actions.sql | 4 ++-- models/gold/nft/nft__dim_nft_contract_metadata.sql | 4 ++-- models/gold/nft/nft__dim_nft_series_metadata.sql | 4 ++-- models/gold/nft/nft__fact_nft_mints.sql | 4 ++-- models/gold/prices/price__fact_prices.sql | 4 ++-- models/gold/social/social__fact_addkey_events.sql | 4 ++-- models/gold/social/social__fact_decoded_actions.sql | 4 ++-- models/gold/social/social__fact_posts.sql | 4 ++-- models/gold/social/social__fact_profile_changes.sql | 4 ++-- models/gold/social/social__fact_widget_deployments.sql | 4 ++-- 33 files changed, 71 insertions(+), 70 deletions(-) diff --git a/models/gold/atlas/atlas__ez_nft_contract_metrics.sql b/models/gold/atlas/atlas__ez_nft_contract_metrics.sql index 05cc086..8212c37 100644 --- a/models/gold/atlas/atlas__ez_nft_contract_metrics.sql +++ b/models/gold/atlas/atlas__ez_nft_contract_metrics.sql @@ -23,8 +23,8 @@ WITH nft_data AS ( owners, transactions, mints, - COALESCE(inserted_timestamp,'2000-01-01' :: TIMESTAMP_NTZ) AS inserted_timestamp, - COALESCE(modified_timestamp,'2000-01-01' :: TIMESTAMP_NTZ) AS modified_timestamp + COALESCE(inserted_timestamp, '2000-01-01' :: TIMESTAMP_NTZ) AS inserted_timestamp, + COALESCE(modified_timestamp, '2000-01-01' :: TIMESTAMP_NTZ) AS modified_timestamp FROM {{ ref('silver__atlas_nft_table') }} ) diff --git a/models/gold/atlas/atlas__ez_nft_contract_metrics_daily.sql b/models/gold/atlas/atlas__ez_nft_contract_metrics_daily.sql index 2fbb541..ca74d83 100644 --- a/models/gold/atlas/atlas__ez_nft_contract_metrics_daily.sql +++ b/models/gold/atlas/atlas__ez_nft_contract_metrics_daily.sql @@ -22,8 +22,8 @@ WITH nft_detailed AS ( owners, transactions, mints, - COALESCE(inserted_timestamp,'2000-01-01' :: TIMESTAMP_NTZ) AS inserted_timestamp, - COALESCE(modified_timestamp,'2000-01-01' :: TIMESTAMP_NTZ) AS modified_timestamp + COALESCE(inserted_timestamp, '2000-01-01' :: TIMESTAMP_NTZ) AS inserted_timestamp, + COALESCE(modified_timestamp, '2000-01-01' :: TIMESTAMP_NTZ) AS modified_timestamp FROM {{ ref('silver__atlas_nft_detailed') }} ) diff --git a/models/gold/atlas/atlas__ez_supply.sql b/models/gold/atlas/atlas__ez_supply.sql index f4ce0cf..5030efe 100644 --- a/models/gold/atlas/atlas__ez_supply.sql +++ b/models/gold/atlas/atlas__ez_supply.sql @@ -31,8 +31,8 @@ WITH supply AS ( perc_staked_locked, perc_staked_circulating, atlas_supply_id AS ez_supply_id, - COALESCE(inserted_timestamp,'2000-01-01' :: TIMESTAMP_NTZ) AS inserted_timestamp, - COALESCE(modified_timestamp,'2000-01-01' :: TIMESTAMP_NTZ) AS modified_timestamp + COALESCE(inserted_timestamp, '2000-01-01' :: TIMESTAMP_NTZ) AS inserted_timestamp, + COALESCE(modified_timestamp, '2000-01-01' :: TIMESTAMP_NTZ) AS modified_timestamp FROM {{ ref('silver__atlas_supply') }} ) diff --git a/models/gold/atlas/atlas__fact_accounts_created.sql b/models/gold/atlas/atlas__fact_accounts_created.sql index 4196701..22350f2 100644 --- a/models/gold/atlas/atlas__fact_accounts_created.sql +++ b/models/gold/atlas/atlas__fact_accounts_created.sql @@ -17,8 +17,8 @@ WITH nft_data AS ( atlas_account_created_id AS fact_accounts_created_id, DAY, wallets_created, - COALESCE(inserted_timestamp,'2000-01-01' :: TIMESTAMP_NTZ) AS inserted_timestamp, - COALESCE(modified_timestamp,'2000-01-01' :: TIMESTAMP_NTZ) AS modified_timestamp + COALESCE(inserted_timestamp, '2000-01-01' :: TIMESTAMP_NTZ) AS inserted_timestamp, + COALESCE(modified_timestamp, '2000-01-01' :: TIMESTAMP_NTZ) AS modified_timestamp FROM {{ ref('silver__atlas_accounts_created') }} ) diff --git a/models/gold/atlas/atlas__fact_maas.sql b/models/gold/atlas/atlas__fact_maas.sql index b5a80eb..717dc4a 100644 --- a/models/gold/atlas/atlas__fact_maas.sql +++ b/models/gold/atlas/atlas__fact_maas.sql @@ -16,7 +16,7 @@ SELECT maa, new_maas, returning_maas, - COALESCE(inserted_timestamp,'2000-01-01' :: TIMESTAMP_NTZ) AS inserted_timestamp, - COALESCE(modified_timestamp,'2000-01-01' :: TIMESTAMP_NTZ) AS modified_timestamp + COALESCE(inserted_timestamp, '2000-01-01' :: TIMESTAMP_NTZ) AS inserted_timestamp, + COALESCE(modified_timestamp, '2000-01-01' :: TIMESTAMP_NTZ) AS modified_timestamp FROM {{ ref('silver__atlas_maa') }} diff --git a/models/gold/atlas/atlas__fact_nft_monthly_txs.sql b/models/gold/atlas/atlas__fact_nft_monthly_txs.sql index f794911..00413e9 100644 --- a/models/gold/atlas/atlas__fact_nft_monthly_txs.sql +++ b/models/gold/atlas/atlas__fact_nft_monthly_txs.sql @@ -17,8 +17,8 @@ WITH TRAILING AS ( atlas_nft_30_trailing_id AS fact_nft_monthly_txs_id, DAY, txns, - COALESCE(inserted_timestamp,'2000-01-01' :: TIMESTAMP_NTZ) AS inserted_timestamp, - COALESCE(modified_timestamp,'2000-01-01' :: TIMESTAMP_NTZ) AS modified_timestamp + COALESCE(inserted_timestamp, '2000-01-01' :: TIMESTAMP_NTZ) AS inserted_timestamp, + COALESCE(modified_timestamp, '2000-01-01' :: TIMESTAMP_NTZ) AS modified_timestamp FROM {{ ref('silver__atlas_nft_30_trailing') }} ) diff --git a/models/gold/core/core__dim_address_labels.sql b/models/gold/core/core__dim_address_labels.sql index 250256a..d353ecd 100644 --- a/models/gold/core/core__dim_address_labels.sql +++ b/models/gold/core/core__dim_address_labels.sql @@ -23,8 +23,8 @@ WITH flipside_labels AS ( ['address'] ) }} ) AS dim_address_labels_id, - COALESCE(inserted_timestamp,'2000-01-01' :: TIMESTAMP_NTZ) AS inserted_timestamp, - COALESCE(modified_timestamp,'2000-01-01' :: TIMESTAMP_NTZ) AS modified_timestamp + COALESCE(inserted_timestamp, _inserted_timestamp, '2000-01-01' :: TIMESTAMP_NTZ) AS inserted_timestamp, + COALESCE(modified_timestamp, _inserted_timestamp, '2000-01-01' :: TIMESTAMP_NTZ) AS modified_timestamp FROM {{ ref('silver__address_labels') }} ) diff --git a/models/gold/core/core__dim_ft_contract_metadata.sql b/models/gold/core/core__dim_ft_contract_metadata.sql index 3e6a15c..59ebaa4 100644 --- a/models/gold/core/core__dim_ft_contract_metadata.sql +++ b/models/gold/core/core__dim_ft_contract_metadata.sql @@ -22,7 +22,7 @@ SELECT ['contract_address'] ) }} ) AS dim_ft_contract_metadata_id, - COALESCE(inserted_timestamp,'2000-01-01' :: TIMESTAMP_NTZ) AS inserted_timestamp, - COALESCE(modified_timestamp,'2000-01-01' :: TIMESTAMP_NTZ) AS modified_timestamp + COALESCE(inserted_timestamp, _inserted_timestamp, '2000-01-01' :: TIMESTAMP_NTZ) AS inserted_timestamp, + COALESCE(modified_timestamp, _inserted_timestamp, '2000-01-01' :: TIMESTAMP_NTZ) AS modified_timestamp FROM ft_contract_metadata diff --git a/models/gold/core/core__dim_token_labels.sql b/models/gold/core/core__dim_token_labels.sql index 2ffbe2a..3c614eb 100644 --- a/models/gold/core/core__dim_token_labels.sql +++ b/models/gold/core/core__dim_token_labels.sql @@ -12,8 +12,8 @@ WITH token_labels AS ( token_contract, decimals, token_labels_id AS dim_token_labels_id, - COALESCE(inserted_timestamp,'2000-01-01' :: TIMESTAMP_NTZ) AS inserted_timestamp, - COALESCE(modified_timestamp,'2000-01-01' :: TIMESTAMP_NTZ) AS modified_timestamp + COALESCE(inserted_timestamp, '2000-01-01' :: TIMESTAMP_NTZ) AS inserted_timestamp, + COALESCE(modified_timestamp, '2000-01-01' :: TIMESTAMP_NTZ) AS modified_timestamp FROM {{ ref('silver__token_labels') }} ), @@ -30,8 +30,8 @@ nearblocks_fts_api AS ( ['token_contract'] ) }} ) AS dim_token_labels_id, - COALESCE(inserted_timestamp,'2000-01-01' :: TIMESTAMP_NTZ) AS inserted_timestamp, - COALESCE(modified_timestamp,'2000-01-01' :: TIMESTAMP_NTZ) AS modified_timestamp + COALESCE(inserted_timestamp, _inserted_timestamp, '2000-01-01' :: TIMESTAMP_NTZ) AS inserted_timestamp, + COALESCE(modified_timestamp, _inserted_timestamp, '2000-01-01' :: TIMESTAMP_NTZ) AS modified_timestamp FROM {{ ref('silver__api_nearblocks_fts') }} ), diff --git a/models/gold/core/core__fact_actions_events.sql b/models/gold/core/core__fact_actions_events.sql index dbc61b1..3050b29 100644 --- a/models/gold/core/core__fact_actions_events.sql +++ b/models/gold/core/core__fact_actions_events.sql @@ -28,7 +28,7 @@ SELECT ['receipt_object_id', 'action_index'] ) }} ) AS fact_actions_events_id, - COALESCE(inserted_timestamp,'2000-01-01' :: TIMESTAMP_NTZ) AS inserted_timestamp, - COALESCE(modified_timestamp,'2000-01-01' :: TIMESTAMP_NTZ) AS modified_timestamp + COALESCE(inserted_timestamp, _inserted_timestamp, '2000-01-01' :: TIMESTAMP_NTZ) AS inserted_timestamp, + COALESCE(modified_timestamp, _inserted_timestamp, '2000-01-01' :: TIMESTAMP_NTZ) AS modified_timestamp FROM actions diff --git a/models/gold/core/core__fact_actions_events_function_call.sql b/models/gold/core/core__fact_actions_events_function_call.sql index 858b7f4..e0053b4 100644 --- a/models/gold/core/core__fact_actions_events_function_call.sql +++ b/models/gold/core/core__fact_actions_events_function_call.sql @@ -29,7 +29,7 @@ SELECT ['action_id'] ) }} ) AS fact_actions_events_function_call_id, - COALESCE(inserted_timestamp,'2000-01-01' :: TIMESTAMP_NTZ) AS inserted_timestamp, - COALESCE(modified_timestamp,'2000-01-01' :: TIMESTAMP_NTZ) AS modified_timestamp + COALESCE(inserted_timestamp, _inserted_timestamp, '2000-01-01' :: TIMESTAMP_NTZ) AS inserted_timestamp, + COALESCE(modified_timestamp, _inserted_timestamp, '2000-01-01' :: TIMESTAMP_NTZ) AS modified_timestamp FROM actions_events_function_call diff --git a/models/gold/core/core__fact_blocks.sql b/models/gold/core/core__fact_blocks.sql index 3178ba3..d75a0bf 100644 --- a/models/gold/core/core__fact_blocks.sql +++ b/models/gold/core/core__fact_blocks.sql @@ -51,7 +51,7 @@ SELECT ['block_id'] ) }} ) AS fact_blocks_id, - COALESCE(inserted_timestamp,'2000-01-01' :: TIMESTAMP_NTZ) AS inserted_timestamp, - COALESCE(modified_timestamp,'2000-01-01' :: TIMESTAMP_NTZ) AS modified_timestamp + COALESCE(inserted_timestamp, _inserted_timestamp, '2000-01-01' :: TIMESTAMP_NTZ) AS inserted_timestamp, + COALESCE(modified_timestamp, _inserted_timestamp, '2000-01-01' :: TIMESTAMP_NTZ) AS modified_timestamp FROM blocks diff --git a/models/gold/core/core__fact_developer_activity.sql b/models/gold/core/core__fact_developer_activity.sql index a208099..46c74e0 100644 --- a/models/gold/core/core__fact_developer_activity.sql +++ b/models/gold/core/core__fact_developer_activity.sql @@ -24,7 +24,7 @@ SELECT ['_res_id'] ) }} ) AS fact_developer_activity_id, - COALESCE(inserted_timestamp,'2000-01-01' :: TIMESTAMP_NTZ) AS inserted_timestamp, - COALESCE(modified_timestamp,'2000-01-01' :: TIMESTAMP_NTZ) AS modified_timestamp + COALESCE(inserted_timestamp, _inserted_timestamp, '2000-01-01' :: TIMESTAMP_NTZ) AS inserted_timestamp, + COALESCE(modified_timestamp, _inserted_timestamp, '2000-01-01' :: TIMESTAMP_NTZ) AS modified_timestamp FROM github_data diff --git a/models/gold/core/core__fact_logs.sql b/models/gold/core/core__fact_logs.sql index 75c73e7..46ffbd6 100644 --- a/models/gold/core/core__fact_logs.sql +++ b/models/gold/core/core__fact_logs.sql @@ -26,7 +26,7 @@ SELECT ['action_id'] ) }} ) AS fact_logs_id, - COALESCE(inserted_timestamp,'2000-01-01' :: TIMESTAMP_NTZ) AS inserted_timestamp, - COALESCE(modified_timestamp,'2000-01-01' :: TIMESTAMP_NTZ) AS modified_timestamp + COALESCE(inserted_timestamp, _inserted_timestamp, '2000-01-01' :: TIMESTAMP_NTZ) AS inserted_timestamp, + COALESCE(modified_timestamp, _inserted_timestamp, '2000-01-01' :: TIMESTAMP_NTZ) AS modified_timestamp FROM logs diff --git a/models/gold/core/core__fact_receipts.sql b/models/gold/core/core__fact_receipts.sql index 73f3a6c..bb670ea 100644 --- a/models/gold/core/core__fact_receipts.sql +++ b/models/gold/core/core__fact_receipts.sql @@ -31,7 +31,7 @@ SELECT ['receipt_object_id'] ) }} ) AS fact_receipts_id, - COALESCE(inserted_timestamp,'2000-01-01' :: TIMESTAMP_NTZ) AS inserted_timestamp, - COALESCE(modified_timestamp,'2000-01-01' :: TIMESTAMP_NTZ) AS modified_timestamp + COALESCE(inserted_timestamp, _inserted_timestamp, '2000-01-01' :: TIMESTAMP_NTZ) AS inserted_timestamp, + COALESCE(modified_timestamp, _inserted_timestamp, '2000-01-01' :: TIMESTAMP_NTZ) AS modified_timestamp FROM receipts diff --git a/models/gold/core/core__fact_transactions.sql b/models/gold/core/core__fact_transactions.sql index d4178b2..80ede95 100644 --- a/models/gold/core/core__fact_transactions.sql +++ b/models/gold/core/core__fact_transactions.sql @@ -32,7 +32,7 @@ SELECT ['tx_hash'] ) }} ) AS fact_transactions_id, - COALESCE(inserted_timestamp,'2000-01-01' :: TIMESTAMP_NTZ) AS inserted_timestamp, - COALESCE(modified_timestamp,'2000-01-01' :: TIMESTAMP_NTZ) AS modified_timestamp + COALESCE(inserted_timestamp, _inserted_timestamp, '2000-01-01' :: TIMESTAMP_NTZ) AS inserted_timestamp, + COALESCE(modified_timestamp, _inserted_timestamp, '2000-01-01' :: TIMESTAMP_NTZ) AS modified_timestamp FROM transactions diff --git a/models/gold/core/core__fact_transfers.sql b/models/gold/core/core__fact_transfers.sql index d6a59ab..bd824f2 100644 --- a/models/gold/core/core__fact_transfers.sql +++ b/models/gold/core/core__fact_transfers.sql @@ -29,7 +29,7 @@ SELECT ['action_id'] ) }} ) AS fact_transfers_id, - COALESCE(inserted_timestamp,'2000-01-01' :: TIMESTAMP_NTZ) AS inserted_timestamp, - COALESCE(modified_timestamp,'2000-01-01' :: TIMESTAMP_NTZ) AS modified_timestamp + COALESCE(inserted_timestamp, _inserted_timestamp, '2000-01-01' :: TIMESTAMP_NTZ) AS inserted_timestamp, + COALESCE(modified_timestamp, _inserted_timestamp, '2000-01-01' :: TIMESTAMP_NTZ) AS modified_timestamp FROM transfers diff --git a/models/gold/defi/defi__ez_dex_swaps.sql b/models/gold/defi/defi__ez_dex_swaps.sql index a6c867a..a227072 100644 --- a/models/gold/defi/defi__ez_dex_swaps.sql +++ b/models/gold/defi/defi__ez_dex_swaps.sql @@ -41,8 +41,9 @@ FINAL AS ( amount_out_raw, amount_out, dex_swaps_id, - COALESCE(inserted_timestamp,'2000-01-01' :: TIMESTAMP_NTZ) AS inserted_timestamp, - COALESCE(modified_timestamp,'2000-01-01' :: TIMESTAMP_NTZ) AS modified_timestamp + _inserted_timestamp, + COALESCE(inserted_timestamp, _inserted_timestamp, '2000-01-01' :: TIMESTAMP_NTZ) AS inserted_timestamp, + COALESCE(modified_timestamp, _inserted_timestamp, '2000-01-01' :: TIMESTAMP_NTZ) AS modified_timestamp FROM dex_swaps WHERE @@ -77,7 +78,7 @@ SELECT ['swap_id'] ) }} ) AS ez_dex_swaps_id, - COALESCE(inserted_timestamp,'2000-01-01' :: TIMESTAMP_NTZ) AS inserted_timestamp, - COALESCE(modified_timestamp,'2000-01-01' :: TIMESTAMP_NTZ) AS modified_timestamp + COALESCE(inserted_timestamp, _inserted_timestamp, '2000-01-01' :: TIMESTAMP_NTZ) AS inserted_timestamp, + COALESCE(modified_timestamp, _inserted_timestamp, '2000-01-01' :: TIMESTAMP_NTZ) AS modified_timestamp FROM FINAL diff --git a/models/gold/governance/gov__dim_staking_pools.sql b/models/gold/governance/gov__dim_staking_pools.sql index 6c4229f..486906e 100644 --- a/models/gold/governance/gov__dim_staking_pools.sql +++ b/models/gold/governance/gov__dim_staking_pools.sql @@ -25,7 +25,7 @@ SELECT ['tx_hash'] ) }} ) AS dim_staking_pools_id, - COALESCE(inserted_timestamp,'2000-01-01' :: TIMESTAMP_NTZ) AS inserted_timestamp, - COALESCE(modified_timestamp,'2000-01-01' :: TIMESTAMP_NTZ) AS modified_timestamp + COALESCE(inserted_timestamp, _inserted_timestamp, '2000-01-01' :: TIMESTAMP_NTZ) AS inserted_timestamp, + COALESCE(modified_timestamp, _inserted_timestamp, '2000-01-01' :: TIMESTAMP_NTZ) AS modified_timestamp FROM staking_pools diff --git a/models/gold/governance/gov__fact_lockup_actions.sql b/models/gold/governance/gov__fact_lockup_actions.sql index 83fb60b..ba43c1a 100644 --- a/models/gold/governance/gov__fact_lockup_actions.sql +++ b/models/gold/governance/gov__fact_lockup_actions.sql @@ -26,8 +26,8 @@ WITH lockup_actions AS ( ['tx_hash'] ) }} ) AS fact_lockup_actions_id, - COALESCE(inserted_timestamp,'2000-01-01' :: TIMESTAMP_NTZ) AS inserted_timestamp, - COALESCE(modified_timestamp,'2000-01-01' :: TIMESTAMP_NTZ) AS modified_timestamp + COALESCE(inserted_timestamp, _inserted_timestamp, '2000-01-01' :: TIMESTAMP_NTZ) AS inserted_timestamp, + COALESCE(modified_timestamp, _inserted_timestamp, '2000-01-01' :: TIMESTAMP_NTZ) AS modified_timestamp FROM {{ ref('silver__lockup_actions') }} ) diff --git a/models/gold/governance/gov__fact_staking_actions.sql b/models/gold/governance/gov__fact_staking_actions.sql index d4dd8f3..f9ea8d4 100644 --- a/models/gold/governance/gov__fact_staking_actions.sql +++ b/models/gold/governance/gov__fact_staking_actions.sql @@ -22,8 +22,8 @@ WITH staking_actions AS ( ['tx_hash'] ) }} ) AS fact_staking_actions_id, - COALESCE(inserted_timestamp,'2000-01-01' :: TIMESTAMP_NTZ) AS inserted_timestamp, - COALESCE(modified_timestamp,'2000-01-01' :: TIMESTAMP_NTZ) AS modified_timestamp + COALESCE(inserted_timestamp, _inserted_timestamp, '2000-01-01' :: TIMESTAMP_NTZ) AS inserted_timestamp, + COALESCE(modified_timestamp, _inserted_timestamp, '2000-01-01' :: TIMESTAMP_NTZ) AS modified_timestamp FROM {{ ref('silver__staking_actions_v2') }} ) diff --git a/models/gold/governance/gov__fact_staking_pool_balances.sql b/models/gold/governance/gov__fact_staking_pool_balances.sql index f008f42..da033dc 100644 --- a/models/gold/governance/gov__fact_staking_pool_balances.sql +++ b/models/gold/governance/gov__fact_staking_pool_balances.sql @@ -20,8 +20,8 @@ WITH balance_changes AS ( ['tx_hash'] ) }} ) AS fact_staking_pool_balances_id, - COALESCE(inserted_timestamp,'2000-01-01' :: TIMESTAMP_NTZ) AS inserted_timestamp, - COALESCE(modified_timestamp,'2000-01-01' :: TIMESTAMP_NTZ) AS modified_timestamp + COALESCE(inserted_timestamp, _inserted_timestamp, '2000-01-01' :: TIMESTAMP_NTZ) AS inserted_timestamp, + COALESCE(modified_timestamp, _inserted_timestamp, '2000-01-01' :: TIMESTAMP_NTZ) AS modified_timestamp FROM {{ ref('silver__pool_balances') }} ) diff --git a/models/gold/governance/gov__fact_staking_pool_daily_balances.sql b/models/gold/governance/gov__fact_staking_pool_daily_balances.sql index cc9af61..aa53111 100644 --- a/models/gold/governance/gov__fact_staking_pool_daily_balances.sql +++ b/models/gold/governance/gov__fact_staking_pool_daily_balances.sql @@ -17,8 +17,8 @@ WITH daily_balance AS ( ['date_day', 'address'] ) }} ) AS fact_staking_pool_daily_balances_id, - COALESCE(inserted_timestamp,'2000-01-01' :: TIMESTAMP_NTZ) AS inserted_timestamp, - COALESCE(modified_timestamp,'2000-01-01' :: TIMESTAMP_NTZ) AS modified_timestamp + COALESCE(inserted_timestamp, '2000-01-01' :: TIMESTAMP_NTZ) AS inserted_timestamp, + COALESCE(modified_timestamp, '2000-01-01' :: TIMESTAMP_NTZ) AS modified_timestamp FROM {{ ref('silver__pool_balance_daily') }} ) diff --git a/models/gold/horizon/horizon__fact_decoded_actions.sql b/models/gold/horizon/horizon__fact_decoded_actions.sql index f4878b8..3867d49 100644 --- a/models/gold/horizon/horizon__fact_decoded_actions.sql +++ b/models/gold/horizon/horizon__fact_decoded_actions.sql @@ -24,8 +24,8 @@ WITH horizon AS ( ['action_id_horizon'] ) }} ) AS fact_decoded_actions_id, - COALESCE(inserted_timestamp,'2000-01-01' :: TIMESTAMP_NTZ) AS inserted_timestamp, - COALESCE(modified_timestamp,'2000-01-01' :: TIMESTAMP_NTZ) AS modified_timestamp + COALESCE(inserted_timestamp, _inserted_timestamp, '2000-01-01' :: TIMESTAMP_NTZ) AS inserted_timestamp, + COALESCE(modified_timestamp, _inserted_timestamp, '2000-01-01' :: TIMESTAMP_NTZ) AS modified_timestamp FROM {{ ref('silver_horizon__decoded_actions') }} WHERE diff --git a/models/gold/nft/nft__dim_nft_contract_metadata.sql b/models/gold/nft/nft__dim_nft_contract_metadata.sql index a31a3e7..4156a85 100644 --- a/models/gold/nft/nft__dim_nft_contract_metadata.sql +++ b/models/gold/nft/nft__dim_nft_contract_metadata.sql @@ -23,7 +23,7 @@ SELECT ['contract_address'] ) }} ) AS dim_nft_contract_metadata_id, - COALESCE(inserted_timestamp,'2000-01-01' :: TIMESTAMP_NTZ) AS inserted_timestamp, - COALESCE(modified_timestamp,'2000-01-01' :: TIMESTAMP_NTZ) AS modified_timestamp + COALESCE(inserted_timestamp, _inserted_timestamp, '2000-01-01' :: TIMESTAMP_NTZ) AS inserted_timestamp, + COALESCE(modified_timestamp, _inserted_timestamp, '2000-01-01' :: TIMESTAMP_NTZ) AS modified_timestamp FROM nft_contract_metadata diff --git a/models/gold/nft/nft__dim_nft_series_metadata.sql b/models/gold/nft/nft__dim_nft_series_metadata.sql index 4560174..b8f9c4d 100644 --- a/models/gold/nft/nft__dim_nft_series_metadata.sql +++ b/models/gold/nft/nft__dim_nft_series_metadata.sql @@ -23,7 +23,7 @@ SELECT ['metadata_id'] ) }} ) AS dim_nft_series_metadata_id, - COALESCE(inserted_timestamp,'2000-01-01' :: TIMESTAMP_NTZ) AS inserted_timestamp, - COALESCE(modified_timestamp,'2000-01-01' :: TIMESTAMP_NTZ) AS modified_timestamp + COALESCE(inserted_timestamp, _inserted_timestamp, '2000-01-01' :: TIMESTAMP_NTZ) AS inserted_timestamp, + COALESCE(modified_timestamp, _inserted_timestamp, '2000-01-01' :: TIMESTAMP_NTZ) AS modified_timestamp FROM series_metadata diff --git a/models/gold/nft/nft__fact_nft_mints.sql b/models/gold/nft/nft__fact_nft_mints.sql index a110ce7..a4047ba 100644 --- a/models/gold/nft/nft__fact_nft_mints.sql +++ b/models/gold/nft/nft__fact_nft_mints.sql @@ -33,8 +33,8 @@ WITH nft_mints AS ( ['mint_action_id'] ) }} ) AS fact_nft_mints_id, - COALESCE(inserted_timestamp,'2000-01-01' :: TIMESTAMP_NTZ) AS inserted_timestamp, - COALESCE(modified_timestamp,'2000-01-01' :: TIMESTAMP_NTZ) AS modified_timestamp + COALESCE(inserted_timestamp, _inserted_timestamp, '2000-01-01' :: TIMESTAMP_NTZ) AS inserted_timestamp, + COALESCE(modified_timestamp, _inserted_timestamp, '2000-01-01' :: TIMESTAMP_NTZ) AS modified_timestamp FROM {{ ref('silver__standard_nft_mint_s3') }} ) diff --git a/models/gold/prices/price__fact_prices.sql b/models/gold/prices/price__fact_prices.sql index 235bca0..a28f048 100644 --- a/models/gold/prices/price__fact_prices.sql +++ b/models/gold/prices/price__fact_prices.sql @@ -21,8 +21,8 @@ WITH oracle_prices AS ( ['block_id', 'token_contract'] ) }} ) AS fact_prices_id, - COALESCE(inserted_timestamp,'2000-01-01' :: TIMESTAMP_NTZ) AS inserted_timestamp, - COALESCE(modified_timestamp,'2000-01-01' :: TIMESTAMP_NTZ) AS modified_timestamp + COALESCE(inserted_timestamp, _inserted_timestamp, '2000-01-01' :: TIMESTAMP_NTZ) AS inserted_timestamp, + COALESCE(modified_timestamp, _inserted_timestamp, '2000-01-01' :: TIMESTAMP_NTZ) AS modified_timestamp FROM {{ ref('silver__prices_oracle_s3') }} ) diff --git a/models/gold/social/social__fact_addkey_events.sql b/models/gold/social/social__fact_addkey_events.sql index f8311e4..2b9f53a 100644 --- a/models/gold/social/social__fact_addkey_events.sql +++ b/models/gold/social/social__fact_addkey_events.sql @@ -16,7 +16,7 @@ SELECT ['action_id'] ) }} ) AS fact_addkey_events_id, - COALESCE(inserted_timestamp,'2000-01-01' :: TIMESTAMP_NTZ) AS inserted_timestamp, - COALESCE(modified_timestamp,'2000-01-01' :: TIMESTAMP_NTZ) AS modified_timestamp + COALESCE(inserted_timestamp, _inserted_timestamp, '2000-01-01' :: TIMESTAMP_NTZ) AS inserted_timestamp, + COALESCE(modified_timestamp, _inserted_timestamp, '2000-01-01' :: TIMESTAMP_NTZ) AS modified_timestamp FROM {{ ref('silver_social__addkey') }} diff --git a/models/gold/social/social__fact_decoded_actions.sql b/models/gold/social/social__fact_decoded_actions.sql index b379b48..55e1abd 100644 --- a/models/gold/social/social__fact_decoded_actions.sql +++ b/models/gold/social/social__fact_decoded_actions.sql @@ -17,7 +17,7 @@ SELECT ['action_id_social'] ) }} ) AS fact_decoded_actions_id, - COALESCE(inserted_timestamp,'2000-01-01' :: TIMESTAMP_NTZ) AS inserted_timestamp, - COALESCE(modified_timestamp,'2000-01-01' :: TIMESTAMP_NTZ) AS modified_timestamp + COALESCE(inserted_timestamp, _inserted_timestamp, '2000-01-01' :: TIMESTAMP_NTZ) AS inserted_timestamp, + COALESCE(modified_timestamp, _inserted_timestamp, '2000-01-01' :: TIMESTAMP_NTZ) AS modified_timestamp FROM {{ ref('silver_social__decoded_actions') }} diff --git a/models/gold/social/social__fact_posts.sql b/models/gold/social/social__fact_posts.sql index 84cad05..d69c6c8 100644 --- a/models/gold/social/social__fact_posts.sql +++ b/models/gold/social/social__fact_posts.sql @@ -18,7 +18,7 @@ SELECT ['action_id_social'] ) }} ) AS fact_posts_id, - COALESCE(inserted_timestamp,'2000-01-01' :: TIMESTAMP_NTZ) AS inserted_timestamp, - COALESCE(modified_timestamp,'2000-01-01' :: TIMESTAMP_NTZ) AS modified_timestamp + COALESCE(inserted_timestamp, _inserted_timestamp, '2000-01-01' :: TIMESTAMP_NTZ) AS inserted_timestamp, + COALESCE(modified_timestamp, _inserted_timestamp, '2000-01-01' :: TIMESTAMP_NTZ) AS modified_timestamp FROM {{ ref('silver_social__posts') }} diff --git a/models/gold/social/social__fact_profile_changes.sql b/models/gold/social/social__fact_profile_changes.sql index f519d4d..69abf76 100644 --- a/models/gold/social/social__fact_profile_changes.sql +++ b/models/gold/social/social__fact_profile_changes.sql @@ -17,7 +17,7 @@ SELECT ['action_id_profile'] ) }} ) AS fact_profile_changes_id, - COALESCE(inserted_timestamp,'2000-01-01' :: TIMESTAMP_NTZ) AS inserted_timestamp, - COALESCE(modified_timestamp,'2000-01-01' :: TIMESTAMP_NTZ) AS modified_timestamp + COALESCE(inserted_timestamp, _inserted_timestamp, '2000-01-01' :: TIMESTAMP_NTZ) AS inserted_timestamp, + COALESCE(modified_timestamp, _inserted_timestamp, '2000-01-01' :: TIMESTAMP_NTZ) AS modified_timestamp FROM {{ ref('silver_social__profile_changes') }} diff --git a/models/gold/social/social__fact_widget_deployments.sql b/models/gold/social/social__fact_widget_deployments.sql index 96412f4..9d818dd 100644 --- a/models/gold/social/social__fact_widget_deployments.sql +++ b/models/gold/social/social__fact_widget_deployments.sql @@ -21,7 +21,7 @@ SELECT ['action_id_social'] ) }} ) AS fact_widget_deployments_id, - COALESCE(inserted_timestamp,'2000-01-01' :: TIMESTAMP_NTZ) AS inserted_timestamp, - COALESCE(modified_timestamp,'2000-01-01' :: TIMESTAMP_NTZ) AS modified_timestamp + COALESCE(inserted_timestamp, _inserted_timestamp, '2000-01-01' :: TIMESTAMP_NTZ) AS inserted_timestamp, + COALESCE(modified_timestamp, _inserted_timestamp, '2000-01-01' :: TIMESTAMP_NTZ) AS modified_timestamp FROM {{ ref('silver_social__widgets') }}