-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Tornado Cash: Fix sources, lowercase and improve materialization strategy #1460
Tornado Cash: Fix sources, lowercase and improve materialization strategy #1460
Conversation
This pull request has been linked to 1 task:
|
This reverts commit f707c2e.
@@ -35,13 +35,13 @@ FROM | |||
AND et.block_time >= (select min(evt_block_time) from {{ source('tornado_cash_ethereum','eth_evt_Deposit') }}) | |||
{% endif %} | |||
{% if is_incremental() %} | |||
AND et.block_time >= (select max(block_time) from {{ this }}) | |||
AND et.block_time >= date_trunc("day", now() - interval '1 week') |
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.
Shouldn't the LEFT JOIN
above be an INNER JOIN
instead? And then you could drop the where filter below.
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.
added this common check to review doc, but many existing queries from v1 will have left joins to look out for
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.
There are cases where you'd want to do a left join as I discovered here. But generally it seems like it should be inner.
@@ -35,13 +35,13 @@ FROM | |||
AND et.block_time >= (select min(evt_block_time) from {{ source('tornado_cash_ethereum','eth_evt_Deposit') }}) |
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.
Can't comment on the actual line but line 32 source('ethereum','transactions_0006'
) should be source('ethereum','transactions')
.
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 believe that source was used specifically for performance reasons, but agreed to revert back if we're comfortable with new performance enhancement changes (could then also remove from source file)
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.
That issue has been resolved now (since last week). We shouldn't refer to these ever though because they can (and will) change without warning.
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.
@soispoke can you update this?
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.
@jeff-dude Done
Discussed this in DMs with @jeff-dude, imo naming should be consistent across the board and since PS: Apologies for not changing the names myself when doing the first tornado cash PR, I will make sure to be careful on names being lowercase going forward! |
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.
mades some small changes regarding lowercasing blockchains and moving from avalanche to avalanche_c for consistency
macros/alter_table_properties.sql
Outdated
@@ -560,17 +560,17 @@ ALTER TABLE airdrop_optimism.addresses SET TBLPROPERTIES ('dune.public'='true', | |||
{% endset %} | |||
|
|||
{% set tornado_cash_deposits %} | |||
ALTER TABLE tornado_cash.deposits SET TBLPROPERTIES ('dune.public'='true', | |||
'dune.data_explorer.blockchains'='["ethereum", "bnb", "avalanche", "gnosis", "optimism", "arbitrum"]', | |||
ALTER VIEW tornado_cash.deposits SET TBLPROPERTIES ('dune.public'='true', |
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.
shouldn't these both be 'table'?
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.
You're right they should, pushed a fix
@@ -35,13 +35,13 @@ FROM | |||
AND et.block_time >= (select min(evt_block_time) from {{ source('tornado_cash_ethereum','eth_evt_Deposit') }}) |
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.
@soispoke can you update this?
to @aalan3 point, should we use this PR to update all joins to base tables as inner join? |
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.
@jeff-dude Done, updated all joins with base tables
Thanks ! |
'dune.data_explorer.category'='abstraction', | ||
'dune.data_explorer.abstraction.type'='project', | ||
'dune.data_explorer.abstraction.name'='tornado_cash', | ||
'dune.data_explorer.contributors'='["hildobby", "dot2dotseurat"]'); | ||
{% endset %} | ||
|
||
{% set tornado_cash_withdrawals %} | ||
ALTER TABLE tornado_cash.withdrawals SET TBLPROPERTIES ('dune.public'='true', | ||
'dune.data_explorer.blockchains'='["ethereum", "bnb", "avalanche", "gnosis", "optimism", "arbitrum"]', | ||
ALTER VIEW tornado_cash.withdrawals SET TBLPROPERTIES ('dune.public'='true', |
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.
@soispoke looks like this one didn't get updated back to 'table'
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.
Brief comments on the purpose of your changes:
For Dune Engine V2
I've checked that:
lowercase_snake_cased
When you are ready for a review, tag duneanalytics/data-experience. We will re-open your forked pull request as an internal pull request. Then your spells will run in dbt and the logs will be avaiable in Github Actions DBT Slim CI. This job will only run the models and tests changed by your PR compared to the production project.