mirror of
https://github.com/FlipsideCrypto/aurora-models.git
synced 2026-02-06 11:01:45 +00:00
fix:macros test
This commit is contained in:
parent
0870c1cb2c
commit
1880f4e213
@ -1,37 +1,34 @@
|
||||
{% macro sequence_gaps(
|
||||
table,
|
||||
partition_by,
|
||||
column
|
||||
) %}
|
||||
{%- set partition_sql = partition_by | join(", ") -%}
|
||||
{%- set previous_column = "prev_" ~ column -%}
|
||||
WITH source AS (
|
||||
SELECT
|
||||
{{ partition_sql + "," if partition_sql }}
|
||||
{{ column }},
|
||||
LAG(
|
||||
{{ column }},
|
||||
1
|
||||
) over (
|
||||
{{ "PARTITION BY " ~ partition_sql if partition_sql }}
|
||||
ORDER BY
|
||||
{{ column }} ASC
|
||||
) AS {{ previous_column }}
|
||||
FROM
|
||||
{{ table }}
|
||||
WHERE
|
||||
block_timestamp::date <= current_date - 1
|
||||
)
|
||||
{% test sequence_gaps(
|
||||
model,
|
||||
partition_by,
|
||||
column_name
|
||||
) %}
|
||||
{%- set partition_sql = partition_by | join(", ") -%}
|
||||
{%- set previous_column = "prev_" ~ column_name -%}
|
||||
WITH source AS (
|
||||
SELECT
|
||||
{{ partition_sql + "," if partition_sql }}
|
||||
{{ column_name }},
|
||||
LAG(
|
||||
{{ column_name }},
|
||||
1
|
||||
) over (
|
||||
{{ "PARTITION BY " ~ partition_sql if partition_sql }}
|
||||
ORDER BY
|
||||
{{ column_name }} ASC
|
||||
) AS {{ previous_column }}
|
||||
FROM
|
||||
{{ model }}
|
||||
)
|
||||
SELECT
|
||||
{{ partition_sql + "," if partition_sql }}
|
||||
{{ previous_column }},
|
||||
{{ column }},
|
||||
{{ column }} - {{ previous_column }}
|
||||
{{ column_name }},
|
||||
{{ column_name }} - {{ previous_column }}
|
||||
- 1 AS gap
|
||||
FROM
|
||||
source
|
||||
WHERE
|
||||
{{ column }} - {{ previous_column }} <> 1
|
||||
{{ column_name }} - {{ previous_column }} <> 1
|
||||
ORDER BY
|
||||
gap DESC
|
||||
{% endmacro %}
|
||||
gap DESC {% endtest %}
|
||||
14
macros/tests/tx_block_count.sql
Normal file
14
macros/tests/tx_block_count.sql
Normal file
@ -0,0 +1,14 @@
|
||||
{% test tx_block_count(
|
||||
model,
|
||||
column_name
|
||||
) %}
|
||||
|
||||
SELECT
|
||||
{{ column_name }},
|
||||
COUNT(DISTINCT block_number) AS num_blocks
|
||||
FROM
|
||||
{{ model }}
|
||||
GROUP BY {{ column_name }}
|
||||
HAVING num_blocks > 1
|
||||
|
||||
{% endtest %}
|
||||
@ -1,4 +1,4 @@
|
||||
{% macro tx_gaps(
|
||||
{% test tx_gaps(
|
||||
model
|
||||
) %}
|
||||
WITH block_base AS (
|
||||
@ -30,4 +30,4 @@ FROM
|
||||
ON block_base.block_id = model_name.block_id
|
||||
WHERE
|
||||
tx_count <> model_tx_count
|
||||
{% endmacro %}
|
||||
{% endtest %}
|
||||
|
||||
5
models/descriptions/contract_address.md
Normal file
5
models/descriptions/contract_address.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs logs_contract_address %}
|
||||
|
||||
The address interacted with for a given event.
|
||||
|
||||
{% enddocs %}
|
||||
5
models/descriptions/event_index.md
Normal file
5
models/descriptions/event_index.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs event_index %}
|
||||
|
||||
Event number within a transaction.
|
||||
|
||||
{% enddocs %}
|
||||
5
models/descriptions/event_removed.md
Normal file
5
models/descriptions/event_removed.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs event_removed %}
|
||||
|
||||
Whether the event has been removed from the transaction.
|
||||
|
||||
{% enddocs %}
|
||||
5
models/descriptions/id_events.md
Normal file
5
models/descriptions/id_events.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs id_events %}
|
||||
|
||||
This is the primary key for this table. This is a concatenation of the transaction hash and the event index at which the event occurred.
|
||||
|
||||
{% enddocs %}
|
||||
5
models/descriptions/logs_data.md
Normal file
5
models/descriptions/logs_data.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs logs_data %}
|
||||
|
||||
The un-decoded event data.
|
||||
|
||||
{% enddocs %}
|
||||
5
models/descriptions/logs_table_doc.md
Normal file
5
models/descriptions/logs_table_doc.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs logs_table_doc %}
|
||||
|
||||
This table contains log level data for the Aurora Blockchain. This table can be used to analyze trends at a log level, for example gas fees vs. total transactions over time. For more information, please see Aurora scan Resources.
|
||||
|
||||
{% enddocs %}
|
||||
5
models/descriptions/nft_origin_sig.md
Normal file
5
models/descriptions/nft_origin_sig.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs nft_origin_sig %}
|
||||
|
||||
The function signature of this transaction.
|
||||
|
||||
{% enddocs %}
|
||||
5
models/descriptions/topics.md
Normal file
5
models/descriptions/topics.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs topics %}
|
||||
|
||||
The un-decoded event input topics.
|
||||
|
||||
{% enddocs %}
|
||||
11
models/gold/core__fact_contracts.sql
Normal file
11
models/gold/core__fact_contracts.sql
Normal file
@ -0,0 +1,11 @@
|
||||
{{ config(
|
||||
materialized = 'view',
|
||||
persist_docs ={ "relation": true,
|
||||
"columns": true },
|
||||
tags = ['core']
|
||||
) }}
|
||||
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
{{ ref('silver__relevant_contracts') }}
|
||||
@ -1,6 +1,6 @@
|
||||
version: 2
|
||||
models:
|
||||
- name: core__fact_event_logs
|
||||
- name: core__fact_logs
|
||||
description: '{{ doc("logs_table_doc") }}'
|
||||
|
||||
columns:
|
||||
@ -9,7 +9,7 @@ models:
|
||||
- name: BLOCK_TIMESTAMP
|
||||
description: '{{ doc("block_timestamp") }}'
|
||||
- name: TX_HASH
|
||||
description: '{{ doc("logs_tx_hash") }}'
|
||||
description: '{{ doc("tx_hash") }}'
|
||||
- name: EVENT_INDEX
|
||||
description: '{{ doc("event_index") }}'
|
||||
- name: CONTRACT_ADDRESS
|
||||
@ -21,12 +21,12 @@ models:
|
||||
- name: EVENT_REMOVED
|
||||
description: '{{ doc("event_removed") }}'
|
||||
- name: _LOG_ID
|
||||
description: '{{ doc("log_id_events") }}'
|
||||
description: '{{ doc("id_events") }}'
|
||||
- name: TX_STATUS
|
||||
description: '{{ doc("tx_status") }}'
|
||||
- name: ORIGIN_FUNCTION_SIGNATURE
|
||||
description: '{{ doc("nft_origin_sig") }}'
|
||||
- name: ORIGIN_FROM_ADDRESS
|
||||
description: '{{ doc("origin_from") }}'
|
||||
description: "The from address at the transaction level."
|
||||
- name: ORIGIN_TO_ADDRESS
|
||||
description: '{{ doc("origin_to") }}'
|
||||
description: "The to address at the transaction level."
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
|
||||
SELECT
|
||||
contract_address,
|
||||
'ethereum' AS blockchain,
|
||||
'Aurora' AS blockchain,
|
||||
COUNT(*) AS events,
|
||||
MAX(block_number) AS latest_block
|
||||
FROM
|
||||
|
||||
@ -108,10 +108,6 @@ models:
|
||||
column_type_list:
|
||||
- NUMBER
|
||||
- FLOAT
|
||||
- name: EFFECTIVE_GAS_PRICE
|
||||
tests:
|
||||
- not_null:
|
||||
where: NOT IS_PENDING
|
||||
- name: ORIGIN_FUNCTION_SIGNATURE
|
||||
tests:
|
||||
- not_null
|
||||
|
||||
Loading…
Reference in New Issue
Block a user