-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Blur: inital fundamentals commit (#453)
- Loading branch information
Showing
7 changed files
with
123 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,7 @@ BITCOIN | |
BITCOIN_FLIPSIDE | ||
BLAST | ||
BLAST_FLIPSIDE | ||
BLUR | ||
BSC | ||
BSC_FLIPSIDE | ||
BUSD | ||
|
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{{ | ||
config( | ||
materialized = 'table', | ||
snowflake_warehouse = 'BLUR', | ||
database = 'blur', | ||
schema = 'core', | ||
alias = 'ez_metrics' | ||
) | ||
}} | ||
|
||
with | ||
blur_fees as ( | ||
select * | ||
from {{ ref("fact_blur_fees") }} | ||
) | ||
, blur_daus as ( | ||
select * | ||
from {{ ref("fact_blur_daus") }} | ||
) | ||
, blur_daily_txns as ( | ||
select * | ||
from {{ ref("fact_blur_daily_txns") }} | ||
) | ||
|
||
select | ||
blur_daus.date, | ||
blur_daus.dau, | ||
blur_daily_txns.daily_txns as txns, | ||
blur_fees.fees | ||
from blur_daus | ||
left join blur_daily_txns | ||
on blur_daus.date = blur_daily_txns.date | ||
left join blur_fees | ||
on blur_daus.date = blur_fees.date |
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,8 @@ | ||
sources: | ||
- name: PROD_LANDING | ||
schema: PROD_LANDING | ||
database: LANDING_DATABASE | ||
tables: | ||
- name: raw_blur_dau | ||
- name: raw_blur_fees | ||
- name: raw_blur_daily_txns |
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,26 @@ | ||
{{ | ||
config( | ||
materialized = 'table' | ||
) | ||
}} | ||
|
||
with | ||
max_extraction as ( | ||
select max(extraction_date) as max_date | ||
from {{ source("PROD_LANDING", "raw_blur_daily_txns") }} | ||
), | ||
latest_data as ( | ||
select parse_json(source_json) as data | ||
from {{ source("PROD_LANDING", "raw_blur_daily_txns") }} | ||
where extraction_date = (select max_date from max_extraction) | ||
), | ||
flattened_data as ( | ||
select | ||
date(to_timestamp(SUBSTR(f.value:time, 0, 10)::date)) as date, | ||
f.value:trades::number as daily_txns | ||
from latest_data, lateral flatten(input => data) as f | ||
) | ||
select date, daily_txns, 'ethereum' as chain, 'blur' as app | ||
from flattened_data | ||
where date < to_date(sysdate()) | ||
order by date desc |
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,26 @@ | ||
{{ | ||
config( | ||
materialized = 'table' | ||
) | ||
}} | ||
|
||
with | ||
max_extraction as ( | ||
select max(extraction_date) as max_date | ||
from {{ source("PROD_LANDING", "raw_blur_dau") }} | ||
), | ||
latest_data as ( | ||
select parse_json(source_json) as data | ||
from {{ source("PROD_LANDING", "raw_blur_dau") }} | ||
where extraction_date = (select max_date from max_extraction) | ||
), | ||
flattened_data as ( | ||
select | ||
date(to_timestamp(SUBSTR(f.value:time, 0, 10)::date)) as date, | ||
f.value:traders::number as dau | ||
from latest_data, lateral flatten(input => data) as f | ||
) | ||
select date, dau, 'ethereum' as chain, 'blur' as app | ||
from flattened_data | ||
where date < to_date(sysdate()) | ||
order by date desc |
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,26 @@ | ||
{{ | ||
config( | ||
materialized = 'table' | ||
) | ||
}} | ||
|
||
with | ||
max_extraction as ( | ||
select max(extraction_date) as max_date | ||
from {{ source("PROD_LANDING", "raw_blur_fees") }} | ||
), | ||
latest_data as ( | ||
select parse_json(source_json) as data | ||
from {{ source("PROD_LANDING", "raw_blur_fees") }} | ||
where extraction_date = (select max_date from max_extraction) | ||
), | ||
flattened_data as ( | ||
select | ||
date(to_timestamp(SUBSTR(f.value:time, 0, 10)::date)) as date, | ||
f.value:fees_paid::number as fees | ||
from latest_data, lateral flatten(input => data) as f | ||
) | ||
select date, fees, 'ethereum' as chain, 'blur' as app | ||
from flattened_data | ||
where date < to_date(sysdate()) | ||
order by date desc |