mirror of
https://github.com/FlipsideCrypto/osmosis-models.git
synced 2026-02-06 11:26:55 +00:00
table, tests, and descriptions (#16)
This commit is contained in:
parent
802cd33ef5
commit
7e36e0ad37
5
models/descriptions/proposal_id.md
Normal file
5
models/descriptions/proposal_id.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs proposal_id %}
|
||||
|
||||
Numeric ID that corresponds to the proposal.
|
||||
|
||||
{% enddocs %}
|
||||
5
models/descriptions/proposal_type.md
Normal file
5
models/descriptions/proposal_type.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs proposal_type %}
|
||||
|
||||
The type of proposal that was submitted.
|
||||
|
||||
{% enddocs %}
|
||||
5
models/descriptions/proposer.md
Normal file
5
models/descriptions/proposer.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs proposer %}
|
||||
|
||||
The address of the validator that submitted the proposal.
|
||||
|
||||
{% enddocs %}
|
||||
71
models/silver/silver__governance_submit_proposal.sql
Normal file
71
models/silver/silver__governance_submit_proposal.sql
Normal file
@ -0,0 +1,71 @@
|
||||
{{ config(
|
||||
materialized = 'incremental',
|
||||
unique_key = "tx_id",
|
||||
incremental_strategy = 'delete+insert',
|
||||
cluster_by = ['_ingested_at::DATE'],
|
||||
) }}
|
||||
|
||||
WITH proposal_ids AS (
|
||||
SELECT
|
||||
tx_id,
|
||||
attribute_value AS proposal_id
|
||||
FROM {{ ref('silver__msg_attributes') }}
|
||||
WHERE msg_type = 'submit_proposal'
|
||||
AND attribute_key = 'proposal_id'
|
||||
|
||||
{% if is_incremental() %}
|
||||
AND _ingested_at :: DATE >= CURRENT_DATE - 2
|
||||
{% endif %}
|
||||
),
|
||||
|
||||
proposal_type AS (
|
||||
SELECT
|
||||
tx_id,
|
||||
attribute_value AS proposal_type
|
||||
FROM {{ ref('silver__msg_attributes') }}
|
||||
WHERE msg_type = 'submit_proposal'
|
||||
AND attribute_key = 'proposal_type'
|
||||
|
||||
{% if is_incremental() %}
|
||||
AND _ingested_at :: DATE >= CURRENT_DATE - 2
|
||||
{% endif %}
|
||||
),
|
||||
|
||||
proposer AS (
|
||||
SELECT
|
||||
tx_id,
|
||||
split_part(attribute_value, '/', 0) as proposer
|
||||
FROM {{ ref('silver__msg_attributes') }}
|
||||
WHERE attribute_key = 'acc_seq'
|
||||
|
||||
{% if is_incremental() %}
|
||||
AND _ingested_at :: DATE >= CURRENT_DATE - 2
|
||||
{% endif %}
|
||||
|
||||
)
|
||||
|
||||
SELECT
|
||||
block_id,
|
||||
block_timestamp,
|
||||
blockchain,
|
||||
chain_id,
|
||||
p.tx_id,
|
||||
tx_status,
|
||||
proposer,
|
||||
p.proposal_id,
|
||||
y.proposal_type,
|
||||
_ingested_at
|
||||
FROM proposal_ids p
|
||||
|
||||
INNER JOIN proposal_type y
|
||||
ON p.tx_id = y.tx_id
|
||||
|
||||
INNER JOIN proposer pp
|
||||
ON p.tx_id = pp.tx_id
|
||||
|
||||
LEFT OUTER JOIN {{ ref('silver__transactions') }} t
|
||||
ON p.tx_id = t.tx_id
|
||||
|
||||
{% if is_incremental() %}
|
||||
WHERE t._ingested_at :: DATE >= CURRENT_DATE - 2
|
||||
{% endif %}
|
||||
59
models/silver/silver__governance_submit_proposal.yml
Normal file
59
models/silver/silver__governance_submit_proposal.yml
Normal file
@ -0,0 +1,59 @@
|
||||
version: 2
|
||||
models:
|
||||
- name: silver__governance_submit_proposal
|
||||
description: Records of all transactions that have occurred on Osmosis, dating back to the genesis block.
|
||||
tests:
|
||||
- dbt_utils.unique_combination_of_columns:
|
||||
combination_of_columns:
|
||||
- TX_ID
|
||||
columns:
|
||||
- name: BLOCK_ID
|
||||
description: "{{ doc('block_id') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- NUMBER
|
||||
- FLOAT
|
||||
- name: BLOCK_TIMESTAMP
|
||||
description: "{{ doc('block_timestamp') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- TIMESTAMP_NTZ
|
||||
- name: BLOCKCHAIN
|
||||
description: "{{ doc('blockchain') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- name: CHAIN_ID
|
||||
description: "{{ doc('chain_id') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- name: TX_ID
|
||||
description: "{{ doc('tx_id') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- name: TX_STATUS
|
||||
description: "{{ doc('tx_status') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- name: PROPOSER
|
||||
description: "{{ doc('tx_code') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- name: PROPOSAL_ID
|
||||
description: "{{ doc('proposal_id') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- name: PROPOSAL_TYPE
|
||||
description: "{{ doc('proposal_type') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- name: _INGESTED_AT
|
||||
description: "{{ doc('ingested_at') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- TIMESTAMP_NTZ
|
||||
Loading…
Reference in New Issue
Block a user