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

44 lines
1.7 KiB
YAML

version: 2
models:
- name: defi__fact_pool_balance_change_events
description: "Fact table that shows the change of the pool balance"
columns:
- name: FACT_POOL_BALANCE_CHANGE_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: "Same as pool name, which pool this bond events happens"
- name: cacao_AMOUNT
description: "The amount of cacao for the pool balance change"
- name: cacao_ADD
description: "False or True, if True, then the event is to add cacao not asset"
- name: ASSET_AMOUNT
description: "The amount of asset for the pool balance change"
- name: ASSET_ADD
description: "False or True, if True, then the event is to add asset not cacao"
- name: REASON
description: "The reason for the pool balance change"
- name: INSERTED_TIMESTAMP
description: '{{ doc("inserted_timestamp") }}'
- name: MODIFIED_TIMESTAMP
description: '{{ doc("modified_timestamp") }}'
tests:
- dbt_constraints.primary_key:
column_name: FACT_POOL_BALANCE_CHANGE_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