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

AN-3826/schema reorg #34

Merged
merged 2 commits into from
Aug 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ version: 2
models:
- name: core__ez_miner_rewards
description: |-
Computes the block reward and total fees per block.
Deprecating soon: This is a notice that we're replacing this table with **BITCOIN.GOV.EZ_MINER_REWARDS** Please migrate queries to the new table by **9/14/23**. There will be no column changes or any other changes of any kind.

tests:
- dbt_utils.recency:
datepart: day
Expand Down
27 changes: 27 additions & 0 deletions models/gold/gov/gov__ez_miner_rewards.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{{ config(
materialized = 'view',
meta={
'database_tags':{
'table': {
'PURPOSE': 'BITCOIN, MINING'
}
}
},
tags = ['core', 'ez']
) }}

WITH blocks AS (

SELECT
*
FROM
{{ ref('silver__block_miner_rewards') }}
)
SELECT
* exclude (
coinbase,
_partition_by_block_id,
_inserted_timestamp
)
FROM
blocks
50 changes: 50 additions & 0 deletions models/gold/gov/gov__ez_miner_rewards.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
version: 2

models:
- name: gov__ez_miner_rewards
Computes the block reward and total fees per block.

tests:
- dbt_utils.recency:
datepart: day
field: block_timestamp
interval: 1
- sequence_gaps:
column_name: block_number
where: BLOCK_TIMESTAMP::DATE < CURRENT_DATE

columns:
- name: BLOCK_TIMESTAMP
description: "{{ doc('block_timestamp') }}"

- name: BLOCK_NUMBER
description: "{{ doc('block_number') }}"
tests:
- unique
- not_null
- dbt_expectations.expect_column_values_to_be_of_type:
column_type: NUMBER

- name: BLOCK_HASH
description: "{{ doc('block_hash') }}"

- name: TOTAL_REWARD
description: "{{ doc('total_reward') }}"
tests:
- not_null
- dbt_expectations.expect_column_values_to_be_of_type:
column_type: FLOAT

- name: BLOCK_REWARD
description: "{{ doc('block_reward') }}"
tests:
- not_null
- dbt_expectations.expect_column_values_to_be_of_type:
column_type: FLOAT

- name: FEES
description: "{{ doc('fee') }}"
tests:
- not_null
- dbt_expectations.expect_column_values_to_be_of_type:
column_type: FLOAT