Skip to content
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

added Optimism chain sankey dbt #388

Merged
merged 1 commit into from
Aug 12, 2024
Merged

added Optimism chain sankey dbt #388

merged 1 commit into from
Aug 12, 2024

Conversation

Sunny77D
Copy link
Contributor

📌 References

🎄 Asset Checklist

  • Added to databases.csv or already exists

🧮 Metric Checklist

  • Added new fact tables if necessary
  • Pulled fact table into ez_asset_metrics.sql table
  • Compiles in Github
  • Show Changed Models in Github matches expectations for what metric value should be

@Sunny77D Sunny77D self-assigned this Aug 12, 2024
@Sunny77D Sunny77D requested a review from a team as a code owner August 12, 2024 14:49
@Sunny77D Sunny77D merged commit 660b20f into main Aug 12, 2024
3 checks passed
@Sunny77D Sunny77D deleted the son/optimism-chain-sankey branch August 12, 2024 14:55
Comment on lines +9 to +26
WITH category_flows as (
SELECT
DATE_TRUNC('day', block_timestamp) as date,
from_category,
to_category,
sum(amount_usd) as amount_usd
FROM {{ ref("fact_optimism_labeled_transfers") }}
GROUP BY from_category, to_category, date
), application_flows as (
SELECT
DATE_TRUNC('day', block_timestamp) as date,
from_category,
to_app,
max(to_friendly_name) as to_friendly_name,
sum(amount_usd) as amount_usd
FROM {{ ref("fact_optimism_labeled_transfers") }}
GROUP BY from_category, to_app, date
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

Could also eliminate the join and the need for multiple CTEs by using GROUPING SETS. And then we can select application_amount_usd vs. category_amount_usd depending on which grouping column is null

SebMelendez01 pushed a commit that referenced this pull request Sep 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants