mirror of
https://github.com/FlipsideCrypto/near-models.git
synced 2026-02-06 14:11:54 +00:00
tx_hash
This commit is contained in:
parent
ad6ef58e1e
commit
8abefa1047
@ -4,7 +4,7 @@
|
||||
|
||||
SELECT
|
||||
record_id,
|
||||
tx_id AS txn_hash,
|
||||
tx_id AS tx_hash,
|
||||
tx_block_index,
|
||||
offset_id,
|
||||
block_id,
|
||||
|
||||
@ -11,7 +11,7 @@ WITH actions_events AS (
|
||||
)
|
||||
SELECT
|
||||
action_id,
|
||||
txn_hash,
|
||||
tx_hash,
|
||||
block_timestamp,
|
||||
action_index,
|
||||
action_name,
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -11,7 +11,7 @@ WITH actions_events_addkey AS (
|
||||
)
|
||||
SELECT
|
||||
action_id,
|
||||
txn_hash,
|
||||
tx_hash,
|
||||
block_timestamp,
|
||||
nonce,
|
||||
public_key,
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -11,7 +11,7 @@ WITH actions_events_function_call AS (
|
||||
)
|
||||
SELECT
|
||||
action_id,
|
||||
txn_hash,
|
||||
tx_hash,
|
||||
block_timestamp,
|
||||
action_name,
|
||||
method_name,
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -12,7 +12,7 @@ WITH receipts AS (
|
||||
SELECT
|
||||
block_timestamp,
|
||||
block_hash,
|
||||
txn_hash,
|
||||
tx_hash,
|
||||
receipt_object_id,
|
||||
receipt_outcome_id,
|
||||
status_value,
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -10,7 +10,7 @@ WITH transactions AS (
|
||||
{{ ref('silver__transactions') }}
|
||||
)
|
||||
SELECT
|
||||
txn_hash,
|
||||
tx_hash,
|
||||
block_height,
|
||||
block_hash,
|
||||
block_timestamp,
|
||||
|
||||
@ -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
|
||||
|
||||
@ -10,7 +10,7 @@ WITH transfers AS (
|
||||
{{ ref('silver__transfers') }}
|
||||
)
|
||||
SELECT
|
||||
txn_hash,
|
||||
tx_hash,
|
||||
action_id,
|
||||
block_timestamp,
|
||||
tx_signer,
|
||||
|
||||
@ -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:
|
||||
|
||||
5
models/descriptions/tx_hash.md
Normal file
5
models/descriptions/tx_hash.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs tx_hash %}
|
||||
|
||||
Unique identifier (hash) of this transaction.
|
||||
|
||||
{% enddocs %}
|
||||
@ -11,7 +11,7 @@ WITH actions_events AS (
|
||||
)
|
||||
SELECT
|
||||
action_id,
|
||||
txn_hash,
|
||||
tx_hash AS txn_hash,
|
||||
block_timestamp,
|
||||
action_index,
|
||||
action_name,
|
||||
|
||||
@ -11,7 +11,7 @@ WITH actions_events_addkey AS (
|
||||
)
|
||||
SELECT
|
||||
action_id,
|
||||
txn_hash,
|
||||
tx_hash AS txn_hash,
|
||||
block_timestamp,
|
||||
nonce,
|
||||
public_key,
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -10,7 +10,7 @@ WITH transactions AS (
|
||||
{{ ref('silver__transactions') }}
|
||||
)
|
||||
SELECT
|
||||
txn_hash,
|
||||
tx_hash AS txn_hash,
|
||||
block_height,
|
||||
block_hash,
|
||||
block_timestamp,
|
||||
|
||||
@ -10,7 +10,7 @@ WITH transfers AS (
|
||||
{{ ref('silver__transfers') }}
|
||||
)
|
||||
SELECT
|
||||
txn_hash,
|
||||
tx_hash AS txn_hash,
|
||||
action_id,
|
||||
block_timestamp,
|
||||
tx_signer,
|
||||
|
||||
@ -24,7 +24,7 @@ n_transactions AS (
|
||||
block_timestamp
|
||||
) AS DATE,
|
||||
COUNT(
|
||||
DISTINCT txn_hash
|
||||
DISTINCT tx_hash
|
||||
) AS daily_transactions
|
||||
FROM
|
||||
txs
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -28,7 +28,7 @@ decoding AS (
|
||||
function_calls AS (
|
||||
SELECT
|
||||
action_id,
|
||||
txn_hash,
|
||||
tx_hash,
|
||||
block_timestamp,
|
||||
action_name,
|
||||
method_name,
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -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
|
||||
*
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user