-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* all re-org changes * gnosis final updates * add decimals * silver priority fix
- Loading branch information
1 parent
099f5a9
commit 5d11f40
Showing
27 changed files
with
329 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,7 @@ SELECT | |
FROM | ||
{{ source( | ||
'crosschain', | ||
'address_labels' | ||
'dim_labels' | ||
) }} | ||
WHERE | ||
blockchain = 'gnosis' | ||
|
19 changes: 19 additions & 0 deletions
19
models/bronze/prices/bronze__asset_metadata_all_providers.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{{ config ( | ||
materialized = 'view' | ||
) }} | ||
|
||
SELECT | ||
token_address, | ||
id, | ||
symbol, | ||
blockchain, | ||
provider, | ||
_unique_key, | ||
_inserted_timestamp | ||
FROM | ||
{{ source( | ||
'crosschain_silver', | ||
'asset_metadata_all_providers' | ||
) }} | ||
WHERE | ||
blockchain = 'gnosis' |
File renamed without changes.
20 changes: 20 additions & 0 deletions
20
models/bronze/prices/bronze__hourly_prices_all_providers.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{{ config ( | ||
materialized = 'view' | ||
) }} | ||
|
||
SELECT | ||
HOUR, | ||
token_address, | ||
blockchain, | ||
provider, | ||
price, | ||
is_imputed, | ||
_inserted_timestamp, | ||
_unique_key | ||
FROM | ||
{{ source( | ||
'crosschain_silver', | ||
'token_prices_all_providers_hourly' | ||
) }} | ||
WHERE | ||
blockchain = 'gnosis' |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{{ config( | ||
materialized = 'view', | ||
persist_docs ={ "relation": true, | ||
"columns": true } | ||
) }} | ||
|
||
SELECT | ||
token_address, | ||
id, | ||
symbol, | ||
NAME, | ||
decimals, | ||
provider | ||
FROM | ||
{{ ref('silver__asset_metadata_all_providers') }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
version: 2 | ||
models: | ||
- name: price__dim_asset_metadata | ||
description: A comprehensive dimensional table holding all provider asset metadata and other relevant details pertaining to each token_address. | ||
tests: | ||
- dbt_utils.unique_combination_of_columns: | ||
combination_of_columns: | ||
- PROVIDER | ||
- ID | ||
- TOKEN_ADDRESS | ||
- SYMBOL | ||
|
||
columns: | ||
- name: PROVIDER | ||
description: The provider or source of the data. | ||
- name: ID | ||
description: The unique identifier representing the asset. | ||
- name: NAME | ||
description: The name of asset. | ||
- name: SYMBOL | ||
description: The symbol of asset. | ||
- name: TOKEN_ADDRESS | ||
description: The specific address representing the asset in a specific platform. | ||
- name: DECIMALS | ||
description: The number of decimal places the token needs adjusted where token values exist. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{{ config( | ||
materialized = 'view', | ||
persist_docs ={ "relation": true, | ||
"columns": true } | ||
) }} | ||
|
||
SELECT | ||
token_address, | ||
id, | ||
symbol, | ||
NAME, | ||
decimals | ||
FROM | ||
{{ ref('silver__asset_metadata_priority') }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
version: 2 | ||
models: | ||
- name: price__ez_asset_metadata | ||
description: A convenience table holding prioritized asset metadata and other relevant details pertaining to each token_address. | ||
tests: | ||
- dbt_utils.unique_combination_of_columns: | ||
combination_of_columns: | ||
- TOKEN_ADDRESS | ||
|
||
columns: | ||
- name: ID | ||
description: The unique identifier representing the asset. | ||
- name: NAME | ||
description: The name of asset. | ||
- name: SYMBOL | ||
description: The symbol of asset. | ||
- name: TOKEN_ADDRESS | ||
description: The specific address representing the asset in a specific platform. | ||
- name: DECIMALS | ||
description: The number of decimal places the token needs adjusted where token values exist. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{{ config( | ||
materialized = 'view', | ||
persist_docs ={ "relation": true, | ||
"columns": true } | ||
) }} | ||
|
||
SELECT | ||
HOUR, | ||
token_address, | ||
symbol, | ||
decimals, | ||
price, | ||
is_imputed | ||
FROM | ||
{{ ref('silver__hourly_prices_priority') }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
version: 2 | ||
models: | ||
- name: price__ez_hourly_token_prices | ||
description: A convenience table for determining token prices by address. | ||
tests: | ||
- dbt_utils.unique_combination_of_columns: | ||
combination_of_columns: | ||
- HOUR | ||
- TOKEN_ADDRESS | ||
|
||
columns: | ||
- name: HOUR | ||
description: Hour that the price was recorded at | ||
- name: TOKEN_ADDRESS | ||
description: Address of the token | ||
- name: SYMBOL | ||
description: Symbol of the token | ||
- name: DECIMALS | ||
description: The number of decimals for token contract | ||
- name: PRICE | ||
description: Closing price of the recorded hour in USD | ||
- name: IS_IMPUTED | ||
description: Whether the price was imputed from an earlier record (generally used for low trade volume tokens) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{{ config( | ||
materialized = 'view', | ||
persist_docs ={ "relation": true, | ||
"columns": true } | ||
) }} | ||
|
||
SELECT | ||
HOUR, | ||
token_address, | ||
price, | ||
is_imputed, | ||
provider | ||
FROM | ||
{{ ref('silver__hourly_prices_all_providers') }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
version: 2 | ||
models: | ||
- name: price__fact_hourly_token_prices | ||
description: A comprehensive fact table holding provider specific hourly token prices. | ||
|
||
columns: | ||
- name: HOUR | ||
description: Hour that the price was recorded at | ||
- name: TOKEN_ADDRESS | ||
description: Address of the token | ||
- name: PROVIDER | ||
description: Source of the token price. | ||
- name: PRICE | ||
description: Closing price of the recorded hour in USD | ||
- name: IS_IMPUTED | ||
description: Whether the price was imputed from an earlier record (generally used for low trade volume tokens) |
This file was deleted.
Oops, something went wrong.
41 changes: 41 additions & 0 deletions
41
models/silver/prices/silver__asset_metadata_all_providers.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{{ config( | ||
materialized = 'incremental', | ||
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 | ||
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 |
18 changes: 18 additions & 0 deletions
18
models/silver/prices/silver__asset_metadata_all_providers.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
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 |
Oops, something went wrong.