mirror of
https://github.com/FlipsideCrypto/aurora-models.git
synced 2026-02-06 14:16:47 +00:00
add: pk keys
This commit is contained in:
parent
037683274e
commit
d2168fcef2
5
models/descriptions/pk_id.md
Normal file
5
models/descriptions/pk_id.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs pk_id %}
|
||||
|
||||
A uniquely generated identifier assigned by a surrogate key
|
||||
|
||||
{% enddocs %}
|
||||
@ -6,6 +6,7 @@
|
||||
) }}
|
||||
|
||||
SELECT
|
||||
block_id,
|
||||
block_number,
|
||||
block_timestamp,
|
||||
'mainnet' AS network,
|
||||
@ -61,6 +62,9 @@ SELECT
|
||||
transactions_root,
|
||||
'uncles',
|
||||
uncles
|
||||
) AS block_header_json
|
||||
) AS block_header_json,
|
||||
inserted_timestamp,
|
||||
modified_timestamp,
|
||||
invocation_id
|
||||
FROM
|
||||
{{ ref('silver__blocks') }}
|
||||
@ -4,6 +4,8 @@ models:
|
||||
description: '{{ doc("blocks_table_doc") }}'
|
||||
|
||||
columns:
|
||||
- name: BLOCK_ID
|
||||
description: '{{ doc("pk_id") }}'
|
||||
- name: BLOCK_NUMBER
|
||||
description: '{{ doc("block_number") }}'
|
||||
- name: BLOCK_TIMESTAMP
|
||||
@ -42,3 +44,9 @@ models:
|
||||
description: '{{ doc("uncle_blocks") }}'
|
||||
- name: BLOCK_HEADER_JSON
|
||||
description: '{{ doc("block_header_json") }}'
|
||||
- name: INSERTED_TIMESTAMP
|
||||
description: "{{ doc('inserted_timestamp') }}"
|
||||
- name: MODIFIED_TIMESTAMP
|
||||
description: "{{ doc('modified_timestamp') }}"
|
||||
- name: INVOCACTION_ID
|
||||
description: "{{ doc('invocation_id') }}"
|
||||
|
||||
@ -18,6 +18,9 @@ SELECT
|
||||
DATA,
|
||||
event_removed,
|
||||
tx_status,
|
||||
_log_id
|
||||
_log_id,
|
||||
inserted_timestamp,
|
||||
modified_timestamp,
|
||||
invocation_id
|
||||
FROM
|
||||
{{ ref('silver__logs') }}
|
||||
@ -30,3 +30,9 @@ models:
|
||||
description: "The from address at the transaction level."
|
||||
- name: ORIGIN_TO_ADDRESS
|
||||
description: "The to address at the transaction level."
|
||||
- name: INSERTED_TIMESTAMP
|
||||
description: "{{ doc('inserted_timestamp') }}"
|
||||
- name: MODIFIED_TIMESTAMP
|
||||
description: "{{ doc('modified_timestamp') }}"
|
||||
- name: INVOCACTION_ID
|
||||
description: "{{ doc('invocation_id') }}"
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
) }}
|
||||
|
||||
SELECT
|
||||
receipts_id,
|
||||
block_number,
|
||||
block_timestamp,
|
||||
block_hash,
|
||||
@ -22,6 +23,9 @@ SELECT
|
||||
POSITION,
|
||||
TYPE,
|
||||
near_receipt_hash,
|
||||
near_transaction_hash
|
||||
near_transaction_hash,
|
||||
inserted_timestamp,
|
||||
modified_timestamp,
|
||||
invocation_id
|
||||
FROM
|
||||
{{ ref('silver__receipts') }}
|
||||
@ -4,6 +4,8 @@ models:
|
||||
description: '{{ doc("receipts_table_doc") }}'
|
||||
|
||||
columns:
|
||||
- name: RECEIPTS_ID
|
||||
description: '{{ doc("pk_id") }}'
|
||||
- name: BLOCK_NUMBER
|
||||
description: '{{ doc("block_number") }}'
|
||||
- name: BLOCK_TIMESTAMP
|
||||
@ -36,3 +38,9 @@ models:
|
||||
description: "Receipt hash on NEAR blockchain"
|
||||
- name: NEAR_TRANSACTION_HASH
|
||||
description: "Transaction hash on NEAR blockchain"
|
||||
- name: INSERTED_TIMESTAMP
|
||||
description: "{{ doc('inserted_timestamp') }}"
|
||||
- name: MODIFIED_TIMESTAMP
|
||||
description: "{{ doc('modified_timestamp') }}"
|
||||
- name: INVOCACTION_ID
|
||||
description: "{{ doc('invocation_id') }}"
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
) }}
|
||||
|
||||
SELECT
|
||||
tx_id,
|
||||
block_number,
|
||||
block_hash,
|
||||
block_timestamp,
|
||||
|
||||
@ -4,6 +4,8 @@ models:
|
||||
description: '{{ doc("tx_table_doc") }}'
|
||||
|
||||
columns:
|
||||
- name: TX_ID
|
||||
description: '{{ doc("pk_id") }}'
|
||||
- name: BLOCK_NUMBER
|
||||
description: '{{ doc("block_number") }}'
|
||||
- name: BLOCK_TIMESTAMP
|
||||
@ -50,3 +52,9 @@ models:
|
||||
description: The s value of the transaction signature.
|
||||
- name: v
|
||||
description: The v value of the transaction signature.
|
||||
- name: INSERTED_TIMESTAMP
|
||||
description: "{{ doc('inserted_timestamp') }}"
|
||||
- name: MODIFIED_TIMESTAMP
|
||||
description: "{{ doc('modified_timestamp') }}"
|
||||
- name: INVOCACTION_ID
|
||||
description: "{{ doc('invocation_id') }}"
|
||||
|
||||
@ -8,6 +8,9 @@
|
||||
) }}
|
||||
|
||||
SELECT
|
||||
{{ dbt_utils.generate_surrogate_key(
|
||||
['block_number']
|
||||
) }} AS block_id,
|
||||
block_number,
|
||||
utils.udf_hex_to_int(
|
||||
DATA :result :timestamp :: STRING
|
||||
@ -47,7 +50,10 @@ SELECT
|
||||
DATA :result :stateRoot :: STRING AS state_root,
|
||||
DATA :result :transactionsRoot :: STRING AS transactions_root,
|
||||
_partition_by_block_id,
|
||||
_inserted_timestamp
|
||||
_inserted_timestamp,
|
||||
SYSDATE() AS inserted_timestamp,
|
||||
SYSDATE() AS modified_timestamp,
|
||||
'{{ invocation_id }}' AS invocation_id
|
||||
FROM
|
||||
|
||||
{% if is_incremental() %}
|
||||
|
||||
@ -175,6 +175,9 @@ FROM
|
||||
)
|
||||
SELECT
|
||||
{{ dbt_utils.generate_surrogate_key(['BLOCK_NUMBER','tx_hash', '_LOG_ID']) }} AS logs_id,
|
||||
SYSDATE() AS inserted_timestamp,
|
||||
SYSDATE() AS modified_timestamp,
|
||||
'{{ invocation_id }}' AS invocation_id,
|
||||
*
|
||||
FROM
|
||||
FINAL qualify(ROW_NUMBER() over (PARTITION BY tx_hash, _log_id
|
||||
|
||||
@ -92,6 +92,9 @@ FINAL AS (
|
||||
|
||||
SELECT
|
||||
{{ dbt_utils.generate_surrogate_key(['BLOCK_NUMBER', 'TX_HASH']) }} AS receipts_id,
|
||||
SYSDATE() AS inserted_timestamp,
|
||||
SYSDATE() AS modified_timestamp,
|
||||
'{{ invocation_id }}' AS invocation_id,
|
||||
*
|
||||
FROM
|
||||
FINAL
|
||||
|
||||
@ -8,7 +8,10 @@ SELECT
|
||||
contract_address,
|
||||
'Aurora' AS blockchain,
|
||||
COUNT(*) AS events,
|
||||
MAX(block_number) AS latest_block
|
||||
MAX(block_number) AS latest_block,
|
||||
SYSDATE() AS inserted_timestamp,
|
||||
SYSDATE() AS modified_timestamp,
|
||||
'{{ invocation_id }}' AS invocation_id
|
||||
FROM
|
||||
{{ ref('silver__logs') }}
|
||||
GROUP BY
|
||||
|
||||
@ -287,7 +287,10 @@ FROM
|
||||
)
|
||||
SELECT
|
||||
*,
|
||||
{{ dbt_utils.generate_surrogate_key(['BLOCK_NUMBER', 'TX_HASH', 'POSITION']) }} AS tx_id
|
||||
{{ dbt_utils.generate_surrogate_key(['BLOCK_NUMBER', 'TX_HASH', 'POSITION']) }} AS tx_id,
|
||||
SYSDATE() AS inserted_timestamp,
|
||||
SYSDATE() AS modified_timestamp,
|
||||
'{{ invocation_id }}' AS invocation_id
|
||||
FROM
|
||||
FINAL qualify(ROW_NUMBER() over (PARTITION BY block_number, tx_hash
|
||||
ORDER BY
|
||||
|
||||
Loading…
Reference in New Issue
Block a user