-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce dex_aggregator_base_trades #6653
Merged
jeff-dude
merged 16 commits into
duneanalytics:main
from
Hosuke:dex-aggregator-refactor-dev
Sep 16, 2024
Merged
Changes from 1 commit
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
7bf5417
Introduce dex_aggregator_base_trades
Hosuke 1d38612
Fix typo
Hosuke 6d3c2b9
Refactor lifi_trades
Hosuke e2ab4af
Add lifi to base_trades
Hosuke b2660e1
Merge branch 'dex-aggregator-refactor-dev' of ssh://github.com/Hosuke…
Hosuke 9be4fcd
Fix config blocks
Hosuke 19969a5
Fix typo
Hosuke f46a237
Fix typo
Hosuke 85944be
Merge branch 'main' into dex-aggregator-refactor-dev
Hosuke 78e564e
Apply suggestions from code review
Hosuke 33520b2
Draft enrich_dex_aggregator_trades macro
Hosuke 3572efa
Remove 5 columns
Hosuke 1a7f641
Remove 5 columns
Hosuke 48ff5cd
Merge branch 'main' into dex-aggregator-refactor-dev
Hosuke b255160
Recover add_tx_columns
Hosuke cced5ae
Merge branch 'main' into dex-aggregator-refactor-dev
Hosuke File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
61 changes: 61 additions & 0 deletions
61
dbt_subprojects/dex/models/aggregator_trades/dex_aggregator_base_trades.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,61 @@ | ||
{{ config( | ||
schema ='dex_aggregator', | ||
, alias = 'base_trades' | ||
, partition_by = ['block_month', 'blockchain', 'project'] | ||
, materialized = 'incremental' | ||
, file_format = 'delta' | ||
, incremental_strategy = 'merge' | ||
, unique_key = ['blockchain', 'project', 'version', 'tx_hash', 'evt_index', 'trace_address'] | ||
, incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] | ||
) | ||
}} | ||
|
||
{% set base_trade_models = [ | ||
] %} | ||
|
||
with base_union as ( | ||
SELECT * | ||
FROM | ||
( | ||
{% for model in base_trade_models %} | ||
SELECT | ||
blockchain | ||
, project | ||
, version | ||
, block_date | ||
, block_month | ||
, block_time | ||
, token_bought_symbol | ||
, token_sold_symbol | ||
, token_pair | ||
, token_bought_amount | ||
, token_sold_amount | ||
, try_cast(token_bought_amount_raw as uint256) as token_bought_amount_raw | ||
, try_cast(token_sold_amount_raw as uint256) as token_sold_amount_raw | ||
Hosuke marked this conversation as resolved.
Show resolved
Hide resolved
|
||
, token_bought_address | ||
, token_sold_address | ||
, taker | ||
, maker | ||
, project_contract_address | ||
, tx_hash | ||
, tx_from | ||
, tx_to | ||
, trace_address | ||
, evt_index | ||
FROM | ||
{{ model }} | ||
WHERE | ||
token_sold_amount_raw >= 0 and token_bought_amount_raw >= 0 | ||
{% if is_incremental() %} | ||
AND {{ incremental_predicate('block_time') }} | ||
{% endif %} | ||
{% if not loop.last %} | ||
UNION ALL | ||
{% endif %} | ||
{% endfor %} | ||
) | ||
) | ||
select | ||
* | ||
from | ||
base_union |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will try to remove these 5 columns from base_trades in order to remove
erc20
source table from base_trades spells.