maya-models/models/gold/defi/defi__fact_gas_events.yml
2025-03-04 12:11:08 -05:00

48 lines
1.6 KiB
YAML

version: 2
models:
- name: defi__fact_gas_events
description: "Fact table that provides the summary of the gas events for each block"
columns:
- name: FACT_GAS_EVENTS_ID
description: "{{ doc('sk') }}"
tests:
- dbt_expectations.expect_column_to_exist
- unique
- name: BLOCK_TIMESTAMP
description: "{{ doc('block_timestamp') }}"
tests:
- not_null:
where: DIM_BLOCK_ID not in ('-1','-2')
- name: DIM_BLOCK_ID
description: "FK to DIM_BLOCK table"
tests:
- negative_one:
where: _inserted_timestamp < (CURRENT_TIMESTAMP - INTERVAL '8 HOURS')
- name: ASSET
description: "{{ doc('asset') }}"
tests:
- not_null
- name: ASSET_E8
description: "The asset amount for this fee, using the price table we can calculate the cacao amount by asset amount"
tests:
- not_null
- name: cacao_E8
description: "The total gas amount in cacao"
tests:
- not_null
- name: TX_COUNT
description: "The total count of transactions within this block id"
tests:
- not_null
- name: INSERTED_TIMESTAMP
description: '{{ doc("inserted_timestamp") }}'
- name: MODIFIED_TIMESTAMP
description: '{{ doc("modified_timestamp") }}'
tests:
- dbt_constraints.primary_key:
column_name: FACT_GAS_EVENTS_ID
- dbt_constraints.foreign_key:
fk_column_name: DIM_BLOCK_ID
pk_table_name: ref('core__dim_block')
pk_column_name: DIM_BLOCK_ID