Skip to content

Commit

Permalink
Merge pull request #186 from Artemis-xyz/feature/spark_ez
Browse files Browse the repository at this point in the history
Create EZ models for Spark
  • Loading branch information
akan72 authored Jun 18, 2024
2 parents 0b6133f + cd21501 commit 286c602
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 6 deletions.
2 changes: 0 additions & 2 deletions models/data_hubs/fact_daily_app_datahub.sql
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,9 @@ with
ref("fact_pancakeswap_bsc_gold"),
ref("fact_pancakeswap_ethereum_gold"),
ref("fact_apex_trading_volume_gold"),
ref("fact_spark_ethereum_borrows_deposits_gold"),
ref("fact_uwu_lend_ethereum_borrows_deposits_gold"),
ref("fact_aevo_trading_volume_gold"),
ref("fact_moonwell_base_borrows_deposits_gold"),
ref("fact_spark_gnosis_borrows_deposits_gold"),
ref("fact_quickswap_polygon_gold"),
ref("fact_fraxswap_ethereum_gold"),
ref("fact_trader_joe_arbitrum_gold"),
Expand Down
30 changes: 30 additions & 0 deletions models/projects/spark/core/ez_spark_metrics_by_chain.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{{
config(
materialized="table",
snowflake_warehouse="SPARK",
database="spark",
schema="core",
alias="ez_metrics_by_chain",
)
}}

with
spark_by_chain as (
{{
dbt_utils.union_relations(
relations=[
ref("fact_spark_ethereum_borrows_deposits_gold"),
ref("fact_spark_gnosis_borrows_deposits_gold"),
],
)
}}
)
select
spark_by_chain.date,
'spark' as app,
'DeFi' as category,
spark_by_chain.chain,
spark_by_chain.daily_borrows_usd,
spark_by_chain.daily_supply_usd
from spark_by_chain
where spark_by_chain.date < to_date(sysdate())
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
{{ config(materialized="table") }}
{{ config(materialized="table", snowflake_warehouse="SPARK") }}
{{ fact_aave_fork_lending("raw_spark_ethereum_borrows_deposits", "ethereum", "spark") }}
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{{ config(materialized="table") }}
{{ config(materialized="table", snowflake_warehouse="SPARK") }}
select date, chain, 'spark' as app, category, daily_borrows_usd, daily_supply_usd
from {{ ref("fact_spark_ethereum_borrows_deposits") }}
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
{{ config(materialized="table") }}
{{ config(materialized="table", snowflake_warehouse="SPARK") }}
{{ fact_aave_fork_lending("raw_spark_gnosis_borrows_deposits", "gnosis", "spark") }}
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{{ config(materialized="table") }}
{{ config(materialized="table", snowflake_warehouse="SPARK") }}
select date, chain, 'spark' as app, category, daily_borrows_usd, daily_supply_usd
from {{ ref("fact_spark_gnosis_borrows_deposits") }}

0 comments on commit 286c602

Please sign in to comment.