-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #102 from Synthetixio/transformers/lint-all-models
Transformers - Lint Models
- Loading branch information
Showing
193 changed files
with
8,142 additions
and
7,171 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
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
target/ | ||
dbt_modules/ | ||
dbt_packages/ | ||
macros/ | ||
templates/ |
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
70 changes: 38 additions & 32 deletions
70
...hetix/models/marts/arbitrum/mainnet/core/fct_core_account_delegation_arbitrum_mainnet.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 |
---|---|---|
@@ -1,54 +1,60 @@ | ||
WITH delegation_changes AS ( | ||
SELECT | ||
with delegation_changes as ( | ||
select | ||
block_timestamp, | ||
account_id, | ||
pool_id, | ||
collateral_type, | ||
{{ convert_wei('amount') }} - LAG({{ convert_wei('amount') }}, 1, 0) over ( | ||
PARTITION BY account_id, | ||
pool_id, | ||
collateral_type | ||
ORDER BY | ||
{{ convert_wei('amount') }} | ||
- LAG({{ convert_wei('amount') }}, 1, 0) over ( | ||
partition by | ||
account_id, | ||
pool_id, | ||
collateral_type | ||
order by | ||
block_timestamp | ||
) AS change_in_amount | ||
FROM | ||
) as change_in_amount | ||
from | ||
{{ ref('core_delegation_updated_arbitrum_mainnet') }} | ||
), | ||
cumulative_delegation AS ( | ||
SELECT | ||
|
||
cumulative_delegation as ( | ||
select | ||
block_timestamp, | ||
account_id, | ||
pool_id, | ||
collateral_type, | ||
SUM(change_in_amount) over ( | ||
PARTITION BY pool_id, | ||
account_id, | ||
collateral_type | ||
ORDER BY | ||
partition by | ||
pool_id, | ||
account_id, | ||
collateral_type | ||
order by | ||
block_timestamp | ||
) AS cumulative_amount_delegated, | ||
) as cumulative_amount_delegated, | ||
ROW_NUMBER() over ( | ||
PARTITION BY pool_id, | ||
account_id, | ||
collateral_type | ||
ORDER BY | ||
block_timestamp DESC | ||
) AS rn | ||
FROM | ||
partition by | ||
pool_id, | ||
account_id, | ||
collateral_type | ||
order by | ||
block_timestamp desc | ||
) as rn | ||
from | ||
delegation_changes | ||
) | ||
SELECT | ||
block_timestamp AS ts, | ||
CAST( | ||
account_id AS text | ||
) AS account_id, | ||
|
||
select | ||
block_timestamp as ts, | ||
pool_id, | ||
collateral_type, | ||
cumulative_amount_delegated AS amount_delegated | ||
FROM | ||
cumulative_amount_delegated as amount_delegated, | ||
CAST( | ||
account_id as text | ||
) as account_id | ||
from | ||
cumulative_delegation | ||
WHERE | ||
where | ||
rn = 1 | ||
ORDER BY | ||
order by | ||
block_timestamp, | ||
collateral_type |
Oops, something went wrong.