This commit is contained in:
forgash_ 2022-07-13 17:41:21 -06:00
parent ad6ef58e1e
commit 8abefa1047
33 changed files with 61 additions and 56 deletions

View File

@ -4,7 +4,7 @@
SELECT
record_id,
tx_id AS txn_hash,
tx_id AS tx_hash,
tx_block_index,
offset_id,
block_id,

View File

@ -11,7 +11,7 @@ WITH actions_events AS (
)
SELECT
action_id,
txn_hash,
tx_hash,
block_timestamp,
action_index,
action_name,

View File

@ -20,8 +20,8 @@ models:
- STRING
- VARCHAR
- name: txn_hash
description: "{{ doc('txn_hash')}}"
- name: tx_hash
description: "{{ doc('tx_hash')}}"
tests:
- not_null
- dbt_expectations.expect_column_values_to_be_in_type_list:

View File

@ -11,7 +11,7 @@ WITH actions_events_addkey AS (
)
SELECT
action_id,
txn_hash,
tx_hash,
block_timestamp,
nonce,
public_key,

View File

@ -20,8 +20,8 @@ models:
- STRING
- VARCHAR
- name: txn_hash
description: "{{ doc('txn_hash')}}"
- name: tx_hash
description: "{{ doc('tx_hash')}}"
tests:
- not_null
- dbt_expectations.expect_column_values_to_be_in_type_list:

View File

@ -11,7 +11,7 @@ WITH actions_events_function_call AS (
)
SELECT
action_id,
txn_hash,
tx_hash,
block_timestamp,
action_name,
method_name,

View File

@ -20,8 +20,8 @@ models:
- STRING
- VARCHAR
- name: txn_hash
description: "{{ doc('txn_hash')}}"
- name: tx_hash
description: "{{ doc('tx_hash')}}"
tests:
- not_null
- dbt_expectations.expect_column_values_to_be_in_type_list:

View File

@ -12,7 +12,7 @@ WITH receipts AS (
SELECT
block_timestamp,
block_hash,
txn_hash,
tx_hash,
receipt_object_id,
receipt_outcome_id,
status_value,

View File

@ -26,8 +26,8 @@ models:
- STRING
- VARCHAR
- name: txn_hash
description: "{{ doc('txn_hash')}}"
- name: tx_hash
description: "{{ doc('tx_hash')}}"
tests:
- not_null
- dbt_expectations.expect_column_values_to_be_in_type_list:

View File

@ -10,7 +10,7 @@ WITH transactions AS (
{{ ref('silver__transactions') }}
)
SELECT
txn_hash,
tx_hash,
block_height,
block_hash,
block_timestamp,

View File

@ -6,7 +6,7 @@ models:
tests:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
- txn_hash
- tx_hash
columns:
- name: block_height
@ -27,8 +27,8 @@ models:
- STRING
- VARCHAR
- name: txn_hash
description: "{{ doc('txn_hash')}}"
- name: tx_hash
description: "{{ doc('tx_hash')}}"
tests:
- not_null
- unique

View File

@ -10,7 +10,7 @@ WITH transfers AS (
{{ ref('silver__transfers') }}
)
SELECT
txn_hash,
tx_hash,
action_id,
block_timestamp,
tx_signer,

View File

@ -10,8 +10,8 @@ models:
- action_id
columns:
- name: txn_hash
description: "{{ doc('txn_hash')}}"
- name: tx_hash
description: "{{ doc('tx_hash')}}"
tests:
- not_null
- dbt_expectations.expect_column_values_to_be_in_type_list:

View File

@ -0,0 +1,5 @@
{% docs tx_hash %}
Unique identifier (hash) of this transaction.
{% enddocs %}

View File

@ -11,7 +11,7 @@ WITH actions_events AS (
)
SELECT
action_id,
txn_hash,
tx_hash AS txn_hash,
block_timestamp,
action_index,
action_name,

View File

@ -11,7 +11,7 @@ WITH actions_events_addkey AS (
)
SELECT
action_id,
txn_hash,
tx_hash AS txn_hash,
block_timestamp,
nonce,
public_key,

View File

@ -11,7 +11,7 @@ WITH actions_events_function_call AS (
)
SELECT
action_id,
txn_hash,
tx_hash AS txn_hash,
block_timestamp,
action_name,
method_name,

View File

@ -12,7 +12,7 @@ WITH receipts AS (
SELECT
block_timestamp,
block_hash,
txn_hash,
tx_hash AS txn_hash,
receipt_object_id,
receipt_outcome_id,
status_value,

View File

@ -10,7 +10,7 @@ WITH transactions AS (
{{ ref('silver__transactions') }}
)
SELECT
txn_hash,
tx_hash AS txn_hash,
block_height,
block_hash,
block_timestamp,

View File

@ -10,7 +10,7 @@ WITH transfers AS (
{{ ref('silver__transfers') }}
)
SELECT
txn_hash,
tx_hash AS txn_hash,
action_id,
block_timestamp,
tx_signer,

View File

@ -24,7 +24,7 @@ n_transactions AS (
block_timestamp
) AS DATE,
COUNT(
DISTINCT txn_hash
DISTINCT tx_hash
) AS daily_transactions
FROM
txs

View File

@ -16,7 +16,7 @@ WITH txs AS (
),
actions AS (
SELECT
txn_hash,
tx_hash,
block_timestamp,
INDEX AS action_index,
CASE
@ -39,10 +39,10 @@ FINAL AS (
SELECT
concat_ws(
'-',
txn_hash,
tx_hash,
action_index
) AS action_id,
txn_hash,
tx_hash,
block_timestamp,
action_index,
action_name,

View File

@ -20,8 +20,8 @@ models:
- STRING
- VARCHAR
- name: txn_hash
description: "{{ doc('txn_hash')}}"
- name: tx_hash
description: "{{ doc('tx_hash')}}"
tests:
- not_null
- dbt_expectations.expect_column_values_to_be_in_type_list:

View File

@ -18,7 +18,7 @@ WITH action_events AS (
addkey_events AS (
SELECT
action_id,
txn_hash,
tx_hash,
block_timestamp,
action_data :access_key :nonce :: NUMBER AS nonce,
action_data :public_key :: STRING AS public_key,

View File

@ -20,8 +20,8 @@ models:
- STRING
- VARCHAR
- name: txn_hash
description: "{{ doc('txn_hash')}}"
- name: tx_hash
description: "{{ doc('tx_hash')}}"
tests:
- not_null
- dbt_expectations.expect_column_values_to_be_in_type_list:

View File

@ -28,7 +28,7 @@ decoding AS (
function_calls AS (
SELECT
action_id,
txn_hash,
tx_hash,
block_timestamp,
action_name,
method_name,

View File

@ -20,8 +20,8 @@ models:
- STRING
- VARCHAR
- name: txn_hash
description: "{{ doc('txn_hash')}}"
- name: tx_hash
description: "{{ doc('tx_hash')}}"
tests:
- not_null
- dbt_expectations.expect_column_values_to_be_in_type_list:

View File

@ -18,7 +18,7 @@ receipts AS (
SELECT
block_timestamp,
block_hash,
txn_hash,
tx_hash,
VALUE :id :: STRING AS receipt_object_id,
VALUE :outcome :receipt_ids AS receipt_outcome_id,
VALUE :outcome :status AS status_value,

View File

@ -26,8 +26,8 @@ models:
- STRING
- VARCHAR
- name: txn_hash
description: "{{ doc('txn_hash')}}"
- name: tx_hash
description: "{{ doc('tx_hash')}}"
tests:
- not_null
- dbt_expectations.expect_column_values_to_be_in_type_list:

View File

@ -1,6 +1,6 @@
{{ config(
materialized = 'incremental',
unique_key = 'txn_hash',
unique_key = 'tx_hash',
incremental_strategy = 'delete+insert',
cluster_by = ['_inserted_timestamp::DATE']
) }}
@ -14,7 +14,7 @@ WITH base_transactions AS (
WHERE
{{ incremental_load_filter('_inserted_timestamp') }}
qualify ROW_NUMBER() over (
PARTITION BY txn_hash
PARTITION BY tx_hash
ORDER BY
_inserted_timestamp DESC
) = 1
@ -23,7 +23,7 @@ transactions AS (
SELECT
block_id AS block_height,
tx :outcome :block_hash :: STRING AS block_hash,
txn_hash,
tx_hash,
block_timestamp,
tx :nonce :: NUMBER AS nonce,
tx :signature :: STRING AS signature,
@ -43,7 +43,7 @@ transactions AS (
),
receipts AS (
SELECT
txn_hash,
tx_hash,
SUM(
VALUE :outcome :gas_burnt :: NUMBER
) AS receipt_gas_burnt,
@ -62,7 +62,7 @@ FINAL AS (
SELECT
t.block_height,
t.block_hash,
t.txn_hash,
t.tx_hash,
t.block_timestamp,
t.nonce,
t.signature,
@ -80,7 +80,7 @@ FINAL AS (
FROM
transactions AS t
JOIN receipts AS r
ON t.txn_hash = r.txn_hash
ON t.tx_hash = r.tx_hash
)
SELECT
*

View File

@ -6,7 +6,7 @@ models:
tests:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
- txn_hash
- tx_hash
columns:
- name: block_height
@ -27,8 +27,8 @@ models:
- STRING
- VARCHAR
- name: txn_hash
description: "{{ doc('txn_hash')}}"
- name: tx_hash
description: "{{ doc('tx_hash')}}"
tests:
- not_null
- unique

View File

@ -8,7 +8,7 @@
WITH action_events AS(
SELECT
txn_hash,
tx_hash,
action_id,
action_data :deposit :: INT AS deposit
FROM
@ -19,7 +19,7 @@ WITH action_events AS(
),
actions AS (
SELECT
t.txn_hash,
t.tx_hash,
A.action_id,
t.block_timestamp,
t.tx_receiver,
@ -37,13 +37,13 @@ actions AS (
FROM
{{ ref('silver__transactions') }} AS t
INNER JOIN action_events AS A
ON A.txn_hash = t.txn_hash
ON A.tx_hash = t.tx_hash
WHERE
{{ incremental_load_filter("_inserted_timestamp") }}
),
FINAL AS (
SELECT
txn_hash,
tx_hash,
action_id,
block_timestamp,
tx_signer,

View File

@ -10,8 +10,8 @@ models:
- action_id
columns:
- name: txn_hash
description: "{{ doc('txn_hash')}}"
- name: tx_hash
description: "{{ doc('tx_hash')}}"
tests:
- not_null
- dbt_expectations.expect_column_values_to_be_in_type_list: