mirror of
https://github.com/FlipsideCrypto/near-models.git
synced 2026-02-06 11:26:52 +00:00
new model yml files and upd blocks gap test
This commit is contained in:
parent
fdad0709a6
commit
0ef0aa8ff9
5
models/descriptions/chunks_json.md
Normal file
5
models/descriptions/chunks_json.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs chunks_json %}
|
||||
|
||||
A JSON containing an array of chunk headers contained in this block.
|
||||
|
||||
{% enddocs %}
|
||||
5
models/descriptions/header_json.md
Normal file
5
models/descriptions/header_json.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs header_json %}
|
||||
|
||||
A JSON containing the block header.
|
||||
|
||||
{% enddocs %}
|
||||
3
models/descriptions/outcome_json.md
Normal file
3
models/descriptions/outcome_json.md
Normal file
@ -0,0 +1,3 @@
|
||||
{% docs outcome_json %}
|
||||
JSON object containing the outcome of the receipt or transaction execution, including gas usage, status, and logs.
|
||||
{% enddocs %}
|
||||
3
models/descriptions/receipt_json.md
Normal file
3
models/descriptions/receipt_json.md
Normal file
@ -0,0 +1,3 @@
|
||||
{% docs receipt_json %}
|
||||
JSON object containing the full receipt data including actions, predecessor, receiver, and other metadata.
|
||||
{% enddocs %}
|
||||
3
models/descriptions/status_json.md
Normal file
3
models/descriptions/status_json.md
Normal file
@ -0,0 +1,3 @@
|
||||
{% docs status_json %}
|
||||
JSON object containing the status of the transaction, including success or failure information.
|
||||
{% enddocs %}
|
||||
3
models/descriptions/transaction_json.md
Normal file
3
models/descriptions/transaction_json.md
Normal file
@ -0,0 +1,3 @@
|
||||
{% docs transaction_json %}
|
||||
JSON object containing the full transaction data including actions, signer, receiver, and other metadata.
|
||||
{% enddocs %}
|
||||
75
models/silver/core/silver__blocks_final.yml
Normal file
75
models/silver/core/silver__blocks_final.yml
Normal file
@ -0,0 +1,75 @@
|
||||
version: 2
|
||||
|
||||
models:
|
||||
- name: silver__blocks_final
|
||||
description: |-
|
||||
Table containing blocks for NEAR.
|
||||
tests:
|
||||
- dbt_utils.recency:
|
||||
datepart: hour
|
||||
field: inserted_timestamp
|
||||
interval: 1
|
||||
|
||||
columns:
|
||||
- name: block_id
|
||||
description: "{{ doc('block_id') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- unique
|
||||
|
||||
- name: block_timestamp
|
||||
description: "{{ doc('block_timestamp') }}"
|
||||
tests:
|
||||
- not_null
|
||||
|
||||
- name: block_hash
|
||||
description: "{{ doc('block_hash') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- unique
|
||||
|
||||
- name: prev_hash
|
||||
description: "{{ doc('prev_hash') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- unique
|
||||
|
||||
- name: block_author
|
||||
description: "{{ doc('block_author') }}"
|
||||
tests:
|
||||
- not_null
|
||||
|
||||
- name: chunks_json
|
||||
description: "{{ doc('chunks_json') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- VARIANT
|
||||
- ARRAY
|
||||
- OBJECT
|
||||
|
||||
- name: header_json
|
||||
description: "{{ doc('header_json') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- VARIANT
|
||||
- OBJECT
|
||||
|
||||
- name: _partition_by_block_number
|
||||
description: "{{ doc('_partition_by_block_number') }}"
|
||||
|
||||
- name: blocks_final_id
|
||||
description: "{{ doc('id') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- unique
|
||||
|
||||
- name: inserted_timestamp
|
||||
description: "{{ doc('inserted_timestamp') }}"
|
||||
|
||||
- name: modified_timestamp
|
||||
description: "{{ doc('modified_timestamp') }}"
|
||||
|
||||
- name: _invocation_id
|
||||
|
||||
98
models/silver/core/silver__receipts_final.yml
Normal file
98
models/silver/core/silver__receipts_final.yml
Normal file
@ -0,0 +1,98 @@
|
||||
version: 2
|
||||
|
||||
models:
|
||||
- name: silver__receipts_final
|
||||
description: |-
|
||||
Table containing transaction receipts for NEAR blockchain.
|
||||
tests:
|
||||
- dbt_utils.recency:
|
||||
datepart: hour
|
||||
field: inserted_timestamp
|
||||
interval: 1
|
||||
|
||||
columns:
|
||||
- name: chunk_hash
|
||||
description: "{{ doc('chunk_hash') }}"
|
||||
tests:
|
||||
- not_null
|
||||
|
||||
- name: block_id
|
||||
description: "{{ doc('block_id') }}"
|
||||
tests:
|
||||
- not_null
|
||||
|
||||
- name: block_timestamp
|
||||
description: "{{ doc('block_timestamp') }}"
|
||||
tests:
|
||||
- not_null
|
||||
|
||||
- name: tx_hash
|
||||
description: "{{ doc('tx_hash') }}"
|
||||
tests:
|
||||
- not_null
|
||||
|
||||
- name: receipt_id
|
||||
description: "{{ doc('receipt_id') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- unique
|
||||
|
||||
- name: predecessor_id
|
||||
description: "{{ doc('predecessor_id') }}"
|
||||
tests:
|
||||
- not_null
|
||||
|
||||
- name: receiver_id
|
||||
description: "{{ doc('receiver_id') }}"
|
||||
tests:
|
||||
- not_null
|
||||
|
||||
- name: receipt_json
|
||||
description: "{{ doc('receipt_json') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- VARIANT
|
||||
- OBJECT
|
||||
|
||||
- name: outcome_json
|
||||
description: "{{ doc('outcome_json') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- VARIANT
|
||||
- OBJECT
|
||||
|
||||
- name: tx_succeeded
|
||||
description: "{{ doc('tx_succeeded') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- BOOLEAN
|
||||
|
||||
- name: receipt_succeeded
|
||||
description: "{{ doc('receipt_succeeded') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- BOOLEAN
|
||||
|
||||
- name: _partition_by_block_number
|
||||
description: "{{ doc('_partition_by_block_number') }}"
|
||||
|
||||
- name: receipts_final_id
|
||||
description: "{{ doc('id') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- unique
|
||||
|
||||
- name: inserted_timestamp
|
||||
description: "{{ doc('inserted_timestamp') }}"
|
||||
|
||||
- name: modified_timestamp
|
||||
description: "{{ doc('modified_timestamp') }}"
|
||||
|
||||
- name: _invocation_id
|
||||
description: "{{ doc('invocation_id') }}"
|
||||
120
models/silver/core/silver__transactions_final.yml
Normal file
120
models/silver/core/silver__transactions_final.yml
Normal file
@ -0,0 +1,120 @@
|
||||
version: 2
|
||||
|
||||
models:
|
||||
- name: silver__transactions_final
|
||||
description: |-
|
||||
Table containing finalized transactions for NEAR blockchain.
|
||||
tests:
|
||||
- dbt_utils.recency:
|
||||
datepart: hour
|
||||
field: inserted_timestamp
|
||||
interval: 1
|
||||
|
||||
columns:
|
||||
- name: chunk_hash
|
||||
description: "{{ doc('chunk_hash') }}"
|
||||
tests:
|
||||
- not_null
|
||||
|
||||
- name: block_id
|
||||
description: "{{ doc('block_id') }}"
|
||||
tests:
|
||||
- not_null
|
||||
|
||||
- name: block_timestamp
|
||||
description: "{{ doc('block_timestamp') }}"
|
||||
tests:
|
||||
- not_null
|
||||
|
||||
- name: tx_hash
|
||||
description: "{{ doc('tx_hash') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- unique
|
||||
|
||||
- name: tx_receiver
|
||||
description: "{{ doc('tx_receiver') }}"
|
||||
tests:
|
||||
- not_null
|
||||
|
||||
- name: tx_signer
|
||||
description: "{{ doc('tx_signer') }}"
|
||||
tests:
|
||||
- not_null
|
||||
|
||||
- name: transaction_json
|
||||
description: "{{ doc('transaction_json') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- VARIANT
|
||||
- OBJECT
|
||||
|
||||
- name: outcome_json
|
||||
description: "{{ doc('outcome_json') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- VARIANT
|
||||
- OBJECT
|
||||
|
||||
- name: status_json
|
||||
description: "{{ doc('status_json') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- VARIANT
|
||||
- OBJECT
|
||||
|
||||
- name: tx_succeeded
|
||||
description: "{{ doc('tx_succeeded') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- BOOLEAN
|
||||
|
||||
- name: gas_used
|
||||
description: "{{ doc('gas_used') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- NUMBER
|
||||
- FLOAT
|
||||
|
||||
- name: transaction_fee
|
||||
description: "{{ doc('transaction_fee') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- NUMBER
|
||||
- FLOAT
|
||||
|
||||
- name: attached_gas
|
||||
description: "{{ doc('attached_gas') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- NUMBER
|
||||
- FLOAT
|
||||
|
||||
- name: _partition_by_block_number
|
||||
description: "{{ doc('_partition_by_block_number') }}"
|
||||
|
||||
- name: transactions_final_id
|
||||
description: "{{ doc('id') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- unique
|
||||
|
||||
- name: inserted_timestamp
|
||||
description: "{{ doc('inserted_timestamp') }}"
|
||||
|
||||
- name: modified_timestamp
|
||||
description: "{{ doc('modified_timestamp') }}"
|
||||
|
||||
- name: _invocation_id
|
||||
description: "{{ doc('invocation_id') }}"
|
||||
@ -22,17 +22,17 @@ WITH silver_blocks AS (
|
||||
block_id ASC
|
||||
) AS prior_hash,
|
||||
_partition_by_block_number,
|
||||
_inserted_timestamp,
|
||||
inserted_timestamp,
|
||||
SYSDATE() AS _test_timestamp
|
||||
FROM
|
||||
{{ ref('silver__streamline_blocks') }}
|
||||
{{ ref('silver__blocks_final') }}
|
||||
|
||||
{% if var('DBT_FULL_TEST') %}
|
||||
WHERE
|
||||
_inserted_timestamp < SYSDATE() - INTERVAL '1 hour'
|
||||
inserted_timestamp < SYSDATE() - INTERVAL '1 hour'
|
||||
{% else %}
|
||||
WHERE
|
||||
_inserted_timestamp BETWEEN SYSDATE() - INTERVAL '7 days'
|
||||
inserted_timestamp BETWEEN SYSDATE() - INTERVAL '7 days'
|
||||
AND SYSDATE() - INTERVAL '1 hour'
|
||||
{% endif %}
|
||||
)
|
||||
@ -42,5 +42,3 @@ FROM
|
||||
silver_blocks
|
||||
WHERE
|
||||
prior_hash <> prev_hash
|
||||
{# Filter out false positive from blocks at start of window (whose parent hash was cut off) #}
|
||||
AND (_inserted_timestamp > SYSDATE() - INTERVAL '7 days' + INTERVAL '1 hour')
|
||||
|
||||
Loading…
Reference in New Issue
Block a user