From f0b3045e1db00be7638a4cf3324ffa40748f0d74 Mon Sep 17 00:00:00 2001 From: viniabussafi <131974393+viniabussafi@users.noreply.github.com> Date: Fri, 13 Dec 2024 21:52:06 +0000 Subject: [PATCH] Update _schema for balancer models (#7331) * Update _schema.yml * Update _schema.yml * Update _schema.yml * Update balancer_v3_ethereum_erc4626_token_prices.sql * Update balancer_v3_gnosis_erc4626_token_prices.sql * Update balancer_v3_erc4626_token_prices.sql --- .../models/_project/balancer/erc4626_tokens/_schema.yml | 6 +++--- .../erc4626_tokens/balancer_v3_erc4626_token_prices.sql | 1 + .../_project/balancer/erc4626_tokens/ethereum/_schema.yml | 6 +++--- .../ethereum/balancer_v3_ethereum_erc4626_token_prices.sql | 4 +++- .../_project/balancer/erc4626_tokens/gnosis/_schema.yml | 6 +++--- .../gnosis/balancer_v3_gnosis_erc4626_token_prices.sql | 3 ++- 6 files changed, 15 insertions(+), 11 deletions(-) diff --git a/dbt_subprojects/hourly_spellbook/models/_project/balancer/erc4626_tokens/_schema.yml b/dbt_subprojects/hourly_spellbook/models/_project/balancer/erc4626_tokens/_schema.yml index 6192f2b94b8..15203c33c6f 100644 --- a/dbt_subprojects/hourly_spellbook/models/_project/balancer/erc4626_tokens/_schema.yml +++ b/dbt_subprojects/hourly_spellbook/models/_project/balancer/erc4626_tokens/_schema.yml @@ -7,7 +7,7 @@ models: project: balancer contributors: viniabussafi config: - tags: ['ethereum', 'gnosis', 'static', 'token', 'mapping'] + tags: ['ethereum', 'gnosis', 'token', 'mapping'] description: > Mapping of ERC4626 tokens, including aTokens and MetaMorpho tokens, and their corresponding underlying tokens. data_tests: @@ -36,7 +36,7 @@ models: project: balancer contributors: viniabussafi config: - tags: ['ethereum', 'gnosis', 'static', 'token', 'pricing'] + tags: ['ethereum', 'gnosis', 'token', 'pricing'] description: > Pricing information for ERC4626 tokens. Prices are derived from the ratio of underlying tokens deposited or withdrawn to shares issued or burned, multiplied by the underlying token price. data_tests: @@ -62,4 +62,4 @@ models: - name: median_price description: "Median price of the static token, computed over the dataset." - name: next_change - description: "Timestamp of the next expected pricing change or event affecting the price." \ No newline at end of file + description: "Timestamp of the next expected pricing change or event affecting the price." diff --git a/dbt_subprojects/hourly_spellbook/models/_project/balancer/erc4626_tokens/balancer_v3_erc4626_token_prices.sql b/dbt_subprojects/hourly_spellbook/models/_project/balancer/erc4626_tokens/balancer_v3_erc4626_token_prices.sql index d47484c2ad3..33553280603 100644 --- a/dbt_subprojects/hourly_spellbook/models/_project/balancer/erc4626_tokens/balancer_v3_erc4626_token_prices.sql +++ b/dbt_subprojects/hourly_spellbook/models/_project/balancer/erc4626_tokens/balancer_v3_erc4626_token_prices.sql @@ -8,6 +8,7 @@ ) }} + {% set balancer_models = [ ref('balancer_v3_ethereum_erc4626_token_prices'), ref('balancer_v3_gnosis_erc4626_token_prices') diff --git a/dbt_subprojects/hourly_spellbook/models/_project/balancer/erc4626_tokens/ethereum/_schema.yml b/dbt_subprojects/hourly_spellbook/models/_project/balancer/erc4626_tokens/ethereum/_schema.yml index ae19546932e..a12e45769be 100644 --- a/dbt_subprojects/hourly_spellbook/models/_project/balancer/erc4626_tokens/ethereum/_schema.yml +++ b/dbt_subprojects/hourly_spellbook/models/_project/balancer/erc4626_tokens/ethereum/_schema.yml @@ -7,7 +7,7 @@ models: project: balancer contributors: viniabussafi config: - tags: ['ethereum', 'static', 'token', 'mapping'] + tags: ['ethereum', 'token', 'mapping'] description: > Mapping of ERC4626 tokens on Ethereum, including aTokens and MetaMorpho tokens, and their corresponding underlying tokens. data_tests: @@ -36,7 +36,7 @@ models: project: balancer contributors: viniabussafi config: - tags: ['ethereum', 'static', 'token', 'prices'] + tags: ['ethereum', 'token', 'prices'] description: > Pricing information for ERC4626 tokens on Ethereum. Prices are derived from the ratio of underlying tokens deposited or withdrawn to shares issued or burned, multiplied by the underlying token price. data_tests: @@ -62,4 +62,4 @@ models: - name: median_price description: "Median price of the static token, computed over the dataset." - name: next_change - description: "Timestamp of the next expected pricing change or event affecting the price." \ No newline at end of file + description: "Timestamp of the next expected pricing change or event affecting the price." diff --git a/dbt_subprojects/hourly_spellbook/models/_project/balancer/erc4626_tokens/ethereum/balancer_v3_ethereum_erc4626_token_prices.sql b/dbt_subprojects/hourly_spellbook/models/_project/balancer/erc4626_tokens/ethereum/balancer_v3_ethereum_erc4626_token_prices.sql index e00a572b011..02d989db3be 100644 --- a/dbt_subprojects/hourly_spellbook/models/_project/balancer/erc4626_tokens/ethereum/balancer_v3_ethereum_erc4626_token_prices.sql +++ b/dbt_subprojects/hourly_spellbook/models/_project/balancer/erc4626_tokens/ethereum/balancer_v3_ethereum_erc4626_token_prices.sql @@ -9,6 +9,7 @@ ) }} + WITH wrap_unwrap AS( SELECT evt_block_time, @@ -62,4 +63,5 @@ SELECT APPROX_PERCENTILE(adjusted_price, 0.5) AS median_price, LEAD(p.evt_block_time, 1, CURRENT_DATE + INTERVAL '1' day) OVER (PARTITION BY wrappedToken ORDER BY p.evt_block_time) AS next_change FROM price_join p -GROUP BY 1, 2, 3, 4, 5, 6, 7 \ No newline at end of file +GROUP BY 1, 2, 3, 4, 5, 6, 7 + diff --git a/dbt_subprojects/hourly_spellbook/models/_project/balancer/erc4626_tokens/gnosis/_schema.yml b/dbt_subprojects/hourly_spellbook/models/_project/balancer/erc4626_tokens/gnosis/_schema.yml index 48cf7ead266..efb3ece0f2b 100644 --- a/dbt_subprojects/hourly_spellbook/models/_project/balancer/erc4626_tokens/gnosis/_schema.yml +++ b/dbt_subprojects/hourly_spellbook/models/_project/balancer/erc4626_tokens/gnosis/_schema.yml @@ -7,7 +7,7 @@ models: project: balancer contributors: viniabussafi config: - tags: ['gnosis', 'static', 'token', 'mapping'] + tags: ['gnosis', 'token', 'mapping'] description: > Mapping of ERC4626 tokens on gnosis, including aTokens and MetaMorpho tokens, and their corresponding underlying tokens. data_tests: @@ -36,7 +36,7 @@ models: project: balancer contributors: viniabussafi config: - tags: ['gnosis', 'static', 'token', 'prices'] + tags: ['gnosis', 'token', 'prices'] description: > Pricing information for ERC4626 tokens on gnosis. Prices are derived from the ratio of underlying tokens deposited or withdrawn to shares issued or burned, multiplied by the underlying token price. data_tests: @@ -62,4 +62,4 @@ models: - name: median_price description: "Median price of the static token, computed over the dataset." - name: next_change - description: "Timestamp of the next expected pricing change or event affecting the price." \ No newline at end of file + description: "Timestamp of the next expected pricing change or event affecting the price." diff --git a/dbt_subprojects/hourly_spellbook/models/_project/balancer/erc4626_tokens/gnosis/balancer_v3_gnosis_erc4626_token_prices.sql b/dbt_subprojects/hourly_spellbook/models/_project/balancer/erc4626_tokens/gnosis/balancer_v3_gnosis_erc4626_token_prices.sql index 34fced964c3..f7166ea170f 100644 --- a/dbt_subprojects/hourly_spellbook/models/_project/balancer/erc4626_tokens/gnosis/balancer_v3_gnosis_erc4626_token_prices.sql +++ b/dbt_subprojects/hourly_spellbook/models/_project/balancer/erc4626_tokens/gnosis/balancer_v3_gnosis_erc4626_token_prices.sql @@ -9,6 +9,7 @@ ) }} + WITH wrap_unwrap AS( SELECT evt_block_time, @@ -62,4 +63,4 @@ SELECT APPROX_PERCENTILE(adjusted_price, 0.5) AS median_price, LEAD(p.evt_block_time, 1, CURRENT_DATE + INTERVAL '1' day) OVER (PARTITION BY wrappedToken ORDER BY p.evt_block_time) AS next_change FROM price_join p -GROUP BY 1, 2, 3, 4, 5, 6, 7 \ No newline at end of file +GROUP BY 1, 2, 3, 4, 5, 6, 7