AN-1195 changes from table review feedback (#10)

* updates

* name correction and uk update
This commit is contained in:
eric-laurello 2022-05-05 11:28:59 -04:00 committed by GitHub
parent 2ce56b09bd
commit d82b1b6082
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 56 additions and 62 deletions

View File

@ -1,4 +1,4 @@
{% docs value %}
{% docs raw_metadata %}
Additional details about the validator or token in json format.

View File

@ -8,7 +8,7 @@ WITH base AS (
base AS address,
NAME AS label,
symbol AS project_name,
denom_units AS VALUE
denom_units AS raw_metadata
FROM
{{ source(
'osmosis_external',
@ -28,6 +28,6 @@ SELECT
'token_contract' AS label_subtype,
label,
project_name,
VALUE
raw_metadata
FROM
base

View File

@ -40,7 +40,7 @@ models:
description: "{{ doc('project_name') }}"
tests:
- not_null
- name: VALUE
description: "{{ doc('value') }}"
- name: RAW_METADATA
description: "{{ doc('raw_metadata') }}"
tests:
- not_null

View File

@ -1,24 +1,26 @@
{{ config(
materialized = 'incremental',
unique_key = "block_id",
unique_key = "CONCAT_WS('-', chain_id, block_id)",
incremental_strategy = 'delete+insert',
cluster_by = ['ingested_at::DATE'],
cluster_by = ['_ingested_at::DATE'],
) }}
SELECT
block_id,
block_timestamp,
chain_id,
tx_count,
header:proposer_address :: STRING AS proposer_address,
header:validators_hash :: STRING AS validator_hash,
ingested_at
FROM {{ ref('bronze__blocks') }}
SELECT
block_id,
block_timestamp,
chain_id,
tx_count,
header :proposer_address :: STRING AS proposer_address,
header :validators_hash :: STRING AS validator_hash,
ingested_at AS _ingested_at
FROM
{{ ref('bronze__blocks') }}
{% if is_incremental() %}
WHERE ingested_at :: DATE >= getdate() - INTERVAL '2 days'
WHERE
ingested_at :: DATE >= CURRENT_DATE -2
{% endif %}
qualify(ROW_NUMBER() over(PARTITION BY block_id
qualify(ROW_NUMBER() over(PARTITION BY chain_id, block_id
ORDER BY
ingested_at DESC)) = 1
ingested_at DESC)) = 1

View File

@ -5,6 +5,7 @@ models:
tests:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
- CHAIN_ID
- BLOCK_ID
columns:
- name: BLOCK_ID
@ -34,6 +35,10 @@ models:
description: "{{ doc('validator_hash') }}"
tests:
- not_null
- name: INGESTED_AT
- 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

View File

@ -2,7 +2,7 @@
materialized = 'incremental',
unique_key = "CONCAT_WS('-', chain_id, block_id, tx_id, msg_index, attribute_index)",
incremental_strategy = 'delete+insert',
cluster_by = ['ingested_at::DATE'],
cluster_by = ['_ingested_at::DATE'],
) }}
SELECT
@ -20,7 +20,7 @@ SELECT
TRY_BASE64_DECODE_STRING(
b.value :value :: STRING
) AS attribute_value,
ingested_at
_ingested_at
FROM
{{ ref('silver__msgs') }} A,
LATERAL FLATTEN(
@ -30,5 +30,5 @@ FROM
{% if is_incremental() %}
WHERE
ingested_at :: DATE >= CURRENT_DATE -2
_ingested_at :: DATE >= CURRENT_DATE -2
{% endif %}

View File

@ -49,7 +49,7 @@ models:
description: "{{ doc('msg_type') }}"
tests:
- not_null
- name: INGESTED_AT
- name: _INGESTED_AT
description: "{{ doc('ingested_at') }}"
tests:
- not_null

View File

@ -2,7 +2,7 @@
materialized = 'incremental',
unique_key = "CONCAT_WS('-', chain_id, block_id, tx_id, msg_index)",
incremental_strategy = 'delete+insert',
cluster_by = ['ingested_at::DATE'],
cluster_by = ['_ingested_at::DATE'],
) }}
SELECT
@ -15,12 +15,12 @@ SELECT
INDEX AS msg_index,
VALUE :type :: STRING AS msg_type,
VALUE AS msg,
ingested_at
_ingested_at
FROM
{{ ref('silver__transactions') }} A,
LATERAL FLATTEN(input => A.msgs)
{% if is_incremental() %}
WHERE
ingested_at :: DATE >= getdate() - INTERVAL '2 days'
_ingested_at :: DATE >= CURRENT_DATE - 2
{% endif %}

View File

@ -9,7 +9,6 @@ models:
- BLOCK_ID
- TX_ID
- MSG_INDEX
- ATTRIBUTE_INDEX
columns:
- name: BLOCK_ID
description: "{{ doc('block_id') }}"
@ -53,9 +52,7 @@ models:
- not_null
- name: MSG
description: "The underlying json from the message or event within the transactions"
tests:
- not_null
- name: INGESTED_AT
- name: _INGESTED_AT
description: "{{ doc('ingested_at') }}"
tests:
- not_null

View File

@ -2,7 +2,7 @@
materialized = 'incremental',
unique_key = "CONCAT_WS('-', chain_id, block_id, tx_id)",
incremental_strategy = 'delete+insert',
cluster_by = ['ingested_at::DATE'],
cluster_by = ['_ingested_at::DATE'],
) }}
SELECT
@ -18,18 +18,17 @@ SELECT
WHEN tx :tx_result :code :: INT = 0 THEN 'SUCCEEDED'
ELSE 'FAILED'
END AS tx_status,
tx_block_index,
tx :tx_result :code :: INT tx_code,
tx :tx_result :events AS msgs,
ingested_at
ingested_at AS _ingested_at
FROM
{{ ref('bronze__transactions') }}
{% if is_incremental() %}
WHERE
ingested_at :: DATE >= getdate() - INTERVAL '2 days'
ingested_at :: DATE >= CURRENT_DATE - 2
{% endif %}
qualify(ROW_NUMBER() over(PARTITION BY tx_id
qualify(ROW_NUMBER() over(PARTITION BY chain_id, block_id, tx_id
ORDER BY
ingested_at DESC)) = 1

View File

@ -57,14 +57,6 @@ models:
description: "{{ doc('tx_status') }}"
tests:
- not_null
- name: TX_BLOCK_INDEX
description: "{{ doc('tx_block_index') }}"
tests:
- not_null
- dbt_expectations.expect_column_values_to_be_in_type_list:
column_type_list:
- NUMBER
- FLOAT
- name: TX_CODE
description: "{{ doc('tx_code') }}"
tests:
@ -77,7 +69,7 @@ models:
description: "The underlying json from the messages or events within the transactions"
tests:
- not_null
- name: INGESTED_AT
- name: _INGESTED_AT
description: "{{ doc('ingested_at') }}"
tests:
- not_null

View File

@ -2,18 +2,17 @@
materialized = 'table'
) }}
SELECT
operator_address AS address,
'osmosis' AS blockchain,
'flipside' AS creator,
'operator' AS label_type,
'validator' AS label_subtype,
moniker AS label,
identity AS project_name,
value
FROM
{{ source(
'osmosis_external',
'validator_metadata_api'
) }}
SELECT
operator_address AS address,
'osmosis' AS blockchain,
'flipside' AS creator,
'operator' AS label_type,
'validator' AS label_subtype,
moniker AS label,
identity AS project_name,
VALUE AS raw_metadata
FROM
{{ source(
'osmosis_external',
'validator_metadata_api'
) }}

View File

@ -44,7 +44,7 @@ models:
- not_null
tests:
- not_null
- name: VALUE
description: "{{ doc('value') }}"
- name: RAW_METADATA
description: "{{ doc('raw_metadata') }}"
tests:
- not_null