mirror of
https://github.com/FlipsideCrypto/flow-models.git
synced 2026-02-06 13:26:44 +00:00
parent
6381b49a6a
commit
14dbded6a7
15
models/core/core__fact_blocks.sql
Normal file
15
models/core/core__fact_blocks.sql
Normal file
@ -0,0 +1,15 @@
|
||||
{{ config(
|
||||
materialized = 'view'
|
||||
) }}
|
||||
|
||||
WITH blocks AS (
|
||||
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
{{ ref('gold__blocks') }}
|
||||
)
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
blocks
|
||||
72
models/core/core__fact_blocks.yml
Normal file
72
models/core/core__fact_blocks.yml
Normal file
@ -0,0 +1,72 @@
|
||||
|
||||
version: 2
|
||||
|
||||
models:
|
||||
- name: core__fact_blocks
|
||||
description: Information about blocks on the FLOW network and corresponding metadata.
|
||||
|
||||
columns:
|
||||
- name: block_height
|
||||
description: "{{ doc('block_height') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- unique
|
||||
- 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_row_values_to_have_recent_data:
|
||||
datepart: day
|
||||
interval: 1
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- TIMESTAMP_NTZ
|
||||
|
||||
- name: network
|
||||
description: "{{ doc('network') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- STRING
|
||||
- VARCHAR
|
||||
|
||||
- name: chain_id
|
||||
description: "{{ doc('chain_id') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- STRING
|
||||
- VARCHAR
|
||||
|
||||
- name: tx_count
|
||||
description: "{{ doc('tx_count') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- NUMBER
|
||||
|
||||
- name: id
|
||||
description: "{{ doc('id') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- STRING
|
||||
- VARCHAR
|
||||
|
||||
- name: parent_id
|
||||
description: "{{ doc('parent_id') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- STRING
|
||||
- VARCHAR
|
||||
35
models/gold/gold__blocks.sql
Normal file
35
models/gold/gold__blocks.sql
Normal file
@ -0,0 +1,35 @@
|
||||
{{ config(
|
||||
materialized = 'incremental',
|
||||
incremental_strategy = 'delete+insert',
|
||||
cluster_by = ['block_timestamp::DATE'],
|
||||
unique_key = 'block_height'
|
||||
) }}
|
||||
|
||||
WITH silver_blocks AS (
|
||||
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
{{ ref('silver__blocks') }}
|
||||
|
||||
{% if is_incremental() %}
|
||||
WHERE
|
||||
_ingested_at :: DATE >= CURRENT_DATE - 2
|
||||
{% endif %}
|
||||
),
|
||||
gold_blocks AS (
|
||||
SELECT
|
||||
block_height,
|
||||
block_timestamp,
|
||||
network,
|
||||
chain_id,
|
||||
tx_count,
|
||||
id,
|
||||
parent_id
|
||||
FROM
|
||||
silver_blocks
|
||||
)
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
gold_blocks
|
||||
72
models/gold/gold__blocks.yml
Normal file
72
models/gold/gold__blocks.yml
Normal file
@ -0,0 +1,72 @@
|
||||
|
||||
version: 2
|
||||
|
||||
models:
|
||||
- name: gold__blocks
|
||||
description: Information about blocks on the FLOW network and corresponding metadata.
|
||||
|
||||
columns:
|
||||
- name: block_height
|
||||
description: "{{ doc('block_height') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- unique
|
||||
- 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_row_values_to_have_recent_data:
|
||||
datepart: day
|
||||
interval: 1
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- TIMESTAMP_NTZ
|
||||
|
||||
- name: network
|
||||
description: "{{ doc('network') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- STRING
|
||||
- VARCHAR
|
||||
|
||||
- name: chain_id
|
||||
description: "{{ doc('chain_id') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- STRING
|
||||
- VARCHAR
|
||||
|
||||
- name: tx_count
|
||||
description: "{{ doc('tx_count') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- NUMBER
|
||||
|
||||
- name: id
|
||||
description: "{{ doc('id') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- STRING
|
||||
- VARCHAR
|
||||
|
||||
- name: parent_id
|
||||
description: "{{ doc('parent_id') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- STRING
|
||||
- VARCHAR
|
||||
@ -4,6 +4,10 @@ version: 2
|
||||
models:
|
||||
- name: silver__blocks
|
||||
description: Information about blocks on the FLOW network and corresponding metadata.
|
||||
tests:
|
||||
- dbt_utils.unique_combination_of_columns:
|
||||
combination_of_columns:
|
||||
- block_height
|
||||
|
||||
columns:
|
||||
- name: block_height
|
||||
|
||||
Loading…
Reference in New Issue
Block a user