removed legacy and deprecations (#285)

This commit is contained in:
drethereum 2024-06-03 15:30:59 -06:00 committed by GitHub
parent 766defdd5c
commit 243a37d8ea
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
25 changed files with 8 additions and 484 deletions

View File

@ -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 = 'optimism'

View File

@ -1,17 +0,0 @@
{{ config (
materialized = 'view'
) }}
SELECT
token_address,
symbol,
provider,
id,
_inserted_timestamp
FROM
{{ source(
'silver_crosschain',
'asset_metadata_priority'
) }}
WHERE
blockchain = 'optimism'

View File

@ -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 = 'optimism'

View File

@ -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 = 'optimism'

View File

@ -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'

View File

@ -26,7 +26,6 @@ There is more information on how to use dbt docs in the last section of this doc
- [fact_blocks](https://flipsidecrypto.github.io/optimism-models/#!/model/model.optimism_models.core__fact_blocks)
- [fact_event_logs](https://flipsidecrypto.github.io/optimism-models/#!/model/model.optimism_models.core__fact_event_logs)
- [fact_decoded_event_logs](https://flipsidecrypto.github.io/optimism-models/#!/model/model.optimism_models.core__fact_decoded_event_logs)
- [fact_hourly_token_prices](https://flipsidecrypto.github.io/optimism-models/#!/model/model.optimism_models.core__fact_hourly_token_prices)
- [fact_token_transfers](https://flipsidecrypto.github.io/optimism-models/#!/model/model.optimism_models.core__fact_token_transfers)
- [fact_traces](https://flipsidecrypto.github.io/optimism-models/#!/model/model.optimism_models.core__fact_traces)
- [fact_transactions](https://flipsidecrypto.github.io/optimism-models/#!/model/model.optimism_models.core__fact_transactions)

View File

@ -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
)
{{ ref('silver__complete_provider_asset_metadata') }}

View File

@ -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

View File

@ -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,

View File

@ -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

View File

@ -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') }}

View File

@ -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.

View File

@ -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') }}

View File

@ -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.

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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 %}

View File

@ -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

View File

@ -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 %}

View File

@ -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

View File

@ -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 %}

View File

@ -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

View File

@ -12,12 +12,6 @@ sources:
schema: core
tables:
- name: dim_labels
- name: ez_hourly_token_prices
- name: ethereum
database: ethereum
schema: core
tables:
- name: fact_hourly_token_prices
- name: ethereum_silver
database: ethereum
schema: silver
@ -28,10 +22,6 @@ sources:
database: "{{ 'crosschain' if target.database == 'OPTIMISM' else 'crosschain_dev' }}"
schema: silver
tables:
- 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