diff --git a/models/bronze/prices/_legacy/bronze__asset_metadata_all_providers.sql b/models/bronze/prices/_legacy/bronze__asset_metadata_all_providers.sql deleted file mode 100644 index 061ce2bb..00000000 --- a/models/bronze/prices/_legacy/bronze__asset_metadata_all_providers.sql +++ /dev/null @@ -1,19 +0,0 @@ -{{ config ( - materialized = 'view' -) }} - -SELECT - token_address, - id, - symbol, - blockchain, - provider, - _unique_key, - _inserted_timestamp -FROM - {{ source( - 'silver_crosschain', - 'asset_metadata_all_providers' - ) }} -WHERE - blockchain = 'base' diff --git a/models/bronze/prices/_legacy/bronze__asset_metadata_priority.sql b/models/bronze/prices/_legacy/bronze__asset_metadata_priority.sql deleted file mode 100644 index 596d1e1a..00000000 --- a/models/bronze/prices/_legacy/bronze__asset_metadata_priority.sql +++ /dev/null @@ -1,17 +0,0 @@ -{{ config ( - materialized = 'view' -) }} - -SELECT - token_address, - symbol, - provider, - id, - _inserted_timestamp -FROM - {{ source( - 'silver_crosschain', - 'asset_metadata_priority' - ) }} -WHERE - blockchain = 'base' diff --git a/models/bronze/prices/_legacy/bronze__hourly_prices_all_providers.sql b/models/bronze/prices/_legacy/bronze__hourly_prices_all_providers.sql deleted file mode 100644 index e82444d3..00000000 --- a/models/bronze/prices/_legacy/bronze__hourly_prices_all_providers.sql +++ /dev/null @@ -1,20 +0,0 @@ -{{ config ( - materialized = 'view' -) }} - -SELECT - HOUR, - token_address, - blockchain, - provider, - price, - is_imputed, - _inserted_timestamp, - _unique_key -FROM - {{ source( - 'silver_crosschain', - 'token_prices_all_providers_hourly' - ) }} -WHERE - blockchain = 'base' diff --git a/models/bronze/prices/_legacy/bronze__hourly_prices_priority.sql b/models/bronze/prices/_legacy/bronze__hourly_prices_priority.sql deleted file mode 100644 index 7d33dd57..00000000 --- a/models/bronze/prices/_legacy/bronze__hourly_prices_priority.sql +++ /dev/null @@ -1,17 +0,0 @@ -{{ config ( - materialized = 'view' -) }} - -SELECT - HOUR, - token_address, - price, - is_imputed, - _inserted_timestamp -FROM - {{ source( - 'silver_crosschain', - 'token_prices_priority_hourly' - ) }} -WHERE - blockchain = 'base' diff --git a/models/bronze/prices/_legacy/bronze__hourly_prices_priority_eth.sql b/models/bronze/prices/_legacy/bronze__hourly_prices_priority_eth.sql deleted file mode 100644 index ed9e4b23..00000000 --- a/models/bronze/prices/_legacy/bronze__hourly_prices_priority_eth.sql +++ /dev/null @@ -1,18 +0,0 @@ -{{ config ( - materialized = 'view' -) }} - -SELECT - HOUR, - token_address, - price, - is_imputed, - _inserted_timestamp -FROM - {{ source( - 'silver_crosschain', - 'token_prices_priority_hourly' - ) }} -WHERE - blockchain = 'ethereum' - AND token_address = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2' diff --git a/models/gold/price/price__dim_asset_metadata.sql b/models/gold/price/price__dim_asset_metadata.sql index ba69cf68..71bf27f0 100644 --- a/models/gold/price/price__dim_asset_metadata.sql +++ b/models/gold/price/price__dim_asset_metadata.sql @@ -6,22 +6,14 @@ SELECT token_address, - asset_id AS id, -- id column pending deprecation asset_id, - A.symbol, - A.name, - C.decimals, -- decimals column pending deprecation + symbol, + name, platform AS blockchain, platform_id AS blockchain_id, provider, - A.inserted_timestamp, - A.modified_timestamp, - A.complete_provider_asset_metadata_id AS dim_asset_metadata_id + inserted_timestamp, + modified_timestamp, + complete_provider_asset_metadata_id AS dim_asset_metadata_id FROM - {{ ref('silver__complete_provider_asset_metadata') }} A - LEFT JOIN {{ ref('core__dim_contracts') }} C --remove this join alongside decimal column deprecation - ON LOWER( - C.address - ) = LOWER( - A.token_address - ) \ No newline at end of file + {{ ref('silver__complete_provider_asset_metadata') }} \ No newline at end of file diff --git a/models/gold/price/price__dim_asset_metadata.yml b/models/gold/price/price__dim_asset_metadata.yml index 7352d961..db7ec288 100644 --- a/models/gold/price/price__dim_asset_metadata.yml +++ b/models/gold/price/price__dim_asset_metadata.yml @@ -1,13 +1,11 @@ version: 2 models: - name: price__dim_asset_metadata - description: Deprecating soon! Note, only the ID and DECIMALS columns are being removed. The dim_asset_metadata table itself is not being deprecated. '{{ doc("prices_dim_asset_metadata_table_doc") }}' + description: '{{ doc("prices_dim_asset_metadata_table_doc") }}' columns: - name: PROVIDER description: '{{ doc("prices_provider")}}' - - name: ID - description: '{{ doc("prices_id_deprecation") }}' - name: ASSET_ID description: '{{ doc("prices_asset_id") }}' - name: NAME @@ -20,8 +18,6 @@ models: description: '{{ doc("prices_blockchain") }}' - name: BLOCKCHAIN_ID description: '{{ doc("prices_blockchain_id") }}' - - name: DECIMALS - description: '{{ doc("prices_decimals_deprecation") }}' - name: DIM_ASSET_METADATA_ID description: '{{ doc("pk") }}' - name: INSERTED_TIMESTAMP diff --git a/models/gold/price/price__ez_asset_metadata.sql b/models/gold/price/price__ez_asset_metadata.sql index a77af413..f8c8f8bd 100644 --- a/models/gold/price/price__ez_asset_metadata.sql +++ b/models/gold/price/price__ez_asset_metadata.sql @@ -6,7 +6,6 @@ SELECT token_address, - asset_id AS id, -- id column pending deprecation asset_id, symbol, NAME, @@ -22,7 +21,6 @@ FROM UNION ALL SELECT NULL AS token_address, - asset_id AS id, -- id column pending deprecation asset_id, symbol, NAME, diff --git a/models/gold/price/price__ez_asset_metadata.yml b/models/gold/price/price__ez_asset_metadata.yml index a2acc804..57088a9b 100644 --- a/models/gold/price/price__ez_asset_metadata.yml +++ b/models/gold/price/price__ez_asset_metadata.yml @@ -1,11 +1,9 @@ version: 2 models: - name: price__ez_asset_metadata - description: Deprecating soon! Note, only the ID column is changing. The ez_asset_metadata table itself is not being deprecated. '{{ doc("prices_ez_asset_metadata_table_doc") }}' + description: '{{ doc("prices_ez_asset_metadata_table_doc") }}' columns: - - name: ID - description: '{{ doc("prices_id_deprecation")}}' - name: ASSET_ID description: '{{ doc("prices_asset_id") }}' - name: NAME diff --git a/models/gold/price/price__ez_hourly_token_prices.sql b/models/gold/price/price__ez_hourly_token_prices.sql deleted file mode 100644 index 53d6494a..00000000 --- a/models/gold/price/price__ez_hourly_token_prices.sql +++ /dev/null @@ -1,29 +0,0 @@ -{{ config( - materialized = 'view', - persist_docs ={ "relation": true, - "columns": true } -) }} - -SELECT - HOUR, - token_address, - symbol, - decimals, - price, - is_imputed, - COALESCE ( - hourly_prices_priority_id, - {{ dbt_utils.generate_surrogate_key( - ['token_address', 'hour'] - ) }} - ) AS ez_hourly_token_prices_id, - COALESCE( - inserted_timestamp, - '2000-01-01' - ) AS inserted_timestamp, - COALESCE( - modified_timestamp, - '2000-01-01' - ) AS modified_timestamp -FROM - {{ ref('silver__hourly_prices_priority') }} diff --git a/models/gold/price/price__ez_hourly_token_prices.yml b/models/gold/price/price__ez_hourly_token_prices.yml deleted file mode 100644 index 4ea34c47..00000000 --- a/models/gold/price/price__ez_hourly_token_prices.yml +++ /dev/null @@ -1,4 +0,0 @@ -version: 2 -models: - - name: price__ez_hourly_token_prices - description: Deprecating soon! Please use price.ez_prices_hourly or price.fact_prices_ohlc_hourly instead. \ No newline at end of file diff --git a/models/gold/price/price__fact_hourly_token_prices.sql b/models/gold/price/price__fact_hourly_token_prices.sql deleted file mode 100644 index 8bb363e5..00000000 --- a/models/gold/price/price__fact_hourly_token_prices.sql +++ /dev/null @@ -1,28 +0,0 @@ -{{ config( - materialized = 'view', - persist_docs ={ "relation": true, - "columns": true } -) }} - -SELECT - HOUR, - token_address, - price, - is_imputed, - provider, - COALESCE ( - hourly_prices_all_providers_id, - {{ dbt_utils.generate_surrogate_key( - ['token_address', 'hour', 'provider'] - ) }} - ) AS fact_hourly_token_prices_id, - COALESCE( - inserted_timestamp, - '2000-01-01' - ) AS inserted_timestamp, - COALESCE( - modified_timestamp, - '2000-01-01' - ) AS modified_timestamp -FROM - {{ ref('silver__hourly_prices_all_providers') }} diff --git a/models/gold/price/price__fact_hourly_token_prices.yml b/models/gold/price/price__fact_hourly_token_prices.yml deleted file mode 100644 index ab8f694d..00000000 --- a/models/gold/price/price__fact_hourly_token_prices.yml +++ /dev/null @@ -1,4 +0,0 @@ -version: 2 -models: - - name: price__fact_hourly_token_prices - description: Deprecating soon! Please use price.ez_prices_hourly or price.fact_prices_ohlc_hourly instead. \ No newline at end of file diff --git a/models/silver/prices/_legacy/silver__asset_metadata_all_providers.sql b/models/silver/prices/_legacy/silver__asset_metadata_all_providers.sql deleted file mode 100644 index 8ccb4223..00000000 --- a/models/silver/prices/_legacy/silver__asset_metadata_all_providers.sql +++ /dev/null @@ -1,48 +0,0 @@ -{{ config( - materialized = 'incremental', - merge_exclude_columns = ["inserted_timestamp"], - unique_key = ['token_address','symbol','id','provider'], - tags = ['non_realtime'] -) }} - -SELECT - token_address, - id, - COALESCE( - C.token_symbol, - p.symbol - ) AS symbol, - token_name AS NAME, - token_decimals AS decimals, - provider, - p._inserted_timestamp, - {{ dbt_utils.generate_surrogate_key( - ['token_address','symbol','id','provider'] - ) }} AS asset_metadata_all_providers_id, - SYSDATE() AS inserted_timestamp, - SYSDATE() AS modified_timestamp, - '{{ invocation_id }}' AS _invocation_id -FROM - {{ ref('bronze__asset_metadata_all_providers') }} - p - LEFT JOIN {{ ref('silver__contracts') }} C - ON LOWER( - C.contract_address - ) = p.token_address -WHERE - 1 = 1 - -{% if is_incremental() %} -AND p._inserted_timestamp >= ( - SELECT - MAX( - _inserted_timestamp - ) - FROM - {{ this }} -) -{% endif %} - -qualify(ROW_NUMBER() over (PARTITION BY token_address, id, COALESCE(C.token_symbol, p.symbol), provider -ORDER BY - p._inserted_timestamp DESC)) = 1 diff --git a/models/silver/prices/_legacy/silver__asset_metadata_all_providers.yml b/models/silver/prices/_legacy/silver__asset_metadata_all_providers.yml deleted file mode 100644 index 8eaedb8c..00000000 --- a/models/silver/prices/_legacy/silver__asset_metadata_all_providers.yml +++ /dev/null @@ -1,18 +0,0 @@ -version: 2 -models: - - name: silver__asset_metadata_all_providers - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - TOKEN_ADDRESS - - SYMBOL - - PROVIDER - - ID - - columns: - - name: TOKEN_ADDRESS - tests: - - not_null - - name: PROVIDER - tests: - - not_null \ No newline at end of file diff --git a/models/silver/prices/_legacy/silver__asset_metadata_priority.sql b/models/silver/prices/_legacy/silver__asset_metadata_priority.sql deleted file mode 100644 index 1e301f66..00000000 --- a/models/silver/prices/_legacy/silver__asset_metadata_priority.sql +++ /dev/null @@ -1,52 +0,0 @@ -{{ config( - materialized = 'incremental', - unique_key = 'token_address', - merge_exclude_columns = ["inserted_timestamp"], - tags = ['non_realtime'] -) }} - -SELECT - p.token_address, - p.id, - COALESCE( - C.token_symbol, - p.symbol - ) AS symbol, - C.token_name AS NAME, - C.token_decimals AS decimals, - p.provider, - CASE - WHEN p.provider = 'coingecko' THEN 1 - WHEN p.provider = 'coinmarketcap' THEN 2 - END AS priority, - p._inserted_timestamp, - {{ dbt_utils.generate_surrogate_key( - ['p.token_address'] - ) }} AS asset_metadata_priority_id, - SYSDATE() AS inserted_timestamp, - SYSDATE() AS modified_timestamp, - '{{ invocation_id }}' AS _invocation_id -FROM - {{ ref('bronze__asset_metadata_priority') }} - p - LEFT JOIN {{ ref('silver__contracts') }} C - ON LOWER( - C.contract_address - ) = p.token_address -WHERE - 1 = 1 - -{% if is_incremental() %} -AND p._inserted_timestamp >= ( - SELECT - MAX( - _inserted_timestamp - ) - FROM - {{ this }} -) -{% endif %} - -qualify(ROW_NUMBER() over (PARTITION BY token_address -ORDER BY - priority ASC)) = 1 diff --git a/models/silver/prices/_legacy/silver__asset_metadata_priority.yml b/models/silver/prices/_legacy/silver__asset_metadata_priority.yml deleted file mode 100644 index 9ccd9566..00000000 --- a/models/silver/prices/_legacy/silver__asset_metadata_priority.yml +++ /dev/null @@ -1,12 +0,0 @@ -version: 2 -models: - - name: silver__asset_metadata_priority - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - TOKEN_ADDRESS - - columns: - - name: TOKEN_ADDRESS - tests: - - not_null diff --git a/models/silver/prices/_legacy/silver__hourly_prices_all_providers.sql b/models/silver/prices/_legacy/silver__hourly_prices_all_providers.sql deleted file mode 100644 index a9a4b05f..00000000 --- a/models/silver/prices/_legacy/silver__hourly_prices_all_providers.sql +++ /dev/null @@ -1,35 +0,0 @@ -{{ config( - materialized = 'incremental', - unique_key = ['token_address', 'hour', 'provider'], - merge_exclude_columns = ["inserted_timestamp"], - tags = ['non_realtime'] -) }} - -SELECT - HOUR, - token_address, - provider, - price, - is_imputed, - _inserted_timestamp, - {{ dbt_utils.generate_surrogate_key( - ['token_address', 'hour', 'provider'] - ) }} AS hourly_prices_all_providers_id, - SYSDATE() AS inserted_timestamp, - SYSDATE() AS modified_timestamp, - '{{ invocation_id }}' AS _invocation_id -FROM - {{ ref('bronze__hourly_prices_all_providers') }} -WHERE - 1 = 1 - -{% if is_incremental() %} -AND _inserted_timestamp >= ( - SELECT - MAX( - _inserted_timestamp - ) - FROM - {{ this }} -) -{% endif %} diff --git a/models/silver/prices/_legacy/silver__hourly_prices_all_providers.yml b/models/silver/prices/_legacy/silver__hourly_prices_all_providers.yml deleted file mode 100644 index faee0058..00000000 --- a/models/silver/prices/_legacy/silver__hourly_prices_all_providers.yml +++ /dev/null @@ -1,17 +0,0 @@ -version: 2 -models: - - name: silver__hourly_prices_all_providers - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - TOKEN_ADDRESS - - HOUR - - PROVIDER - - columns: - - name: HOUR - tests: - - not_null - - dbt_expectations.expect_row_values_to_have_recent_data: - datepart: day - interval: 1 \ No newline at end of file diff --git a/models/silver/prices/_legacy/silver__hourly_prices_priority.sql b/models/silver/prices/_legacy/silver__hourly_prices_priority.sql deleted file mode 100644 index 09053f0b..00000000 --- a/models/silver/prices/_legacy/silver__hourly_prices_priority.sql +++ /dev/null @@ -1,45 +0,0 @@ -{{ config( - materialized = 'incremental', - unique_key = ['token_address', 'hour'], - merge_exclude_columns = ["inserted_timestamp"], - tags = ['non_realtime'] -) }} - -SELECT - p.hour, - p.token_address, - p.price, - p.is_imputed, - p._inserted_timestamp, - COALESCE( - C.token_symbol, - m.symbol - ) AS symbol, - C.token_decimals AS decimals, - {{ dbt_utils.generate_surrogate_key( - ['p.token_address', 'p.hour'] - ) }} AS hourly_prices_priority_id, - SYSDATE() AS inserted_timestamp, - SYSDATE() AS modified_timestamp, - '{{ invocation_id }}' AS _invocation_id -FROM - {{ ref('bronze__hourly_prices_priority') }} - p - LEFT JOIN {{ ref('silver__asset_metadata_priority') }} - m - ON p.token_address = m.token_address - LEFT JOIN {{ ref('silver__contracts') }} C - ON p.token_address = C.contract_address -WHERE - 1 = 1 - -{% if is_incremental() %} -AND p._inserted_timestamp >= ( - SELECT - MAX( - _inserted_timestamp - ) - INTERVAL '24 hours' - FROM - {{ this }} -) -{% endif %} diff --git a/models/silver/prices/_legacy/silver__hourly_prices_priority.yml b/models/silver/prices/_legacy/silver__hourly_prices_priority.yml deleted file mode 100644 index 3bfb2b7f..00000000 --- a/models/silver/prices/_legacy/silver__hourly_prices_priority.yml +++ /dev/null @@ -1,16 +0,0 @@ -version: 2 -models: - - name: silver__hourly_prices_priority - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - TOKEN_ADDRESS - - HOUR - - columns: - - name: HOUR - tests: - - not_null - - dbt_expectations.expect_row_values_to_have_recent_data: - datepart: day - interval: 1 \ No newline at end of file diff --git a/models/silver/prices/_legacy/silver__hourly_prices_priority_eth.sql b/models/silver/prices/_legacy/silver__hourly_prices_priority_eth.sql deleted file mode 100644 index 9bae884f..00000000 --- a/models/silver/prices/_legacy/silver__hourly_prices_priority_eth.sql +++ /dev/null @@ -1,34 +0,0 @@ -{{ config( - materialized = 'incremental', - unique_key = ['token_address', 'hour'], - merge_exclude_columns = ["inserted_timestamp"], - tags = ['non_realtime'] -) }} - -SELECT - HOUR, - token_address, - price, - is_imputed, - _inserted_timestamp, - {{ dbt_utils.generate_surrogate_key( - ['token_address', 'hour'] - ) }} AS hourly_prices_priority_eth_id, - SYSDATE() AS inserted_timestamp, - SYSDATE() AS modified_timestamp, - '{{ invocation_id }}' AS _invocation_id -FROM - {{ ref('bronze__hourly_prices_priority_eth') }} -WHERE - 1 = 1 - -{% if is_incremental() %} -AND _inserted_timestamp >= ( - SELECT - MAX( - _inserted_timestamp - ) - FROM - {{ this }} -) -{% endif %} diff --git a/models/silver/prices/_legacy/silver__hourly_prices_priority_eth.yml b/models/silver/prices/_legacy/silver__hourly_prices_priority_eth.yml deleted file mode 100644 index 2ccb5436..00000000 --- a/models/silver/prices/_legacy/silver__hourly_prices_priority_eth.yml +++ /dev/null @@ -1,16 +0,0 @@ -version: 2 -models: - - name: silver__hourly_prices_priority_eth - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - TOKEN_ADDRESS - - HOUR - - columns: - - name: HOUR - tests: - - not_null - - dbt_expectations.expect_row_values_to_have_recent_data: - datepart: day - interval: 1 \ No newline at end of file diff --git a/models/sources.yml b/models/sources.yml index 90a185ab..aa1bdd2d 100644 --- a/models/sources.yml +++ b/models/sources.yml @@ -1,12 +1,6 @@ version: 2 sources: - - name: ethereum - database: ethereum - schema: core - tables: - - name: fact_hourly_token_prices - - name: ez_hourly_token_prices - name: bronze_streamline database: streamline schema: | @@ -27,19 +21,10 @@ sources: schema: core tables: - name: dim_labels - - name: ez_hourly_token_prices - name: silver_crosschain database: "{{ 'crosschain' if target.database == 'BASE' else 'crosschain_dev' }}" schema: silver tables: - - name: asset_metadata_coin_gecko - - name: asset_metadata_coin_market_cap - - name: hourly_prices_coin_gecko - - name: hourly_prices_coin_market_cap - - name: token_prices_priority_hourly - - name: token_prices_all_providers_hourly - - name: asset_metadata_priority - - name: asset_metadata_all_providers - name: near_address_encoded - name: labels_combined - name: complete_token_asset_metadata