silver yml files and tests

This commit is contained in:
forgash_ 2023-11-08 13:55:13 -07:00
parent ed07056958
commit fb6059c2cb
11 changed files with 139 additions and 3 deletions

View File

@ -0,0 +1,5 @@
{% docs active_day %}
Date of activity.
{% enddocs %}

View File

@ -0,0 +1,5 @@
{% docs inserted_timestamp %}
The timestamp at which the record was initially created and inserted into this table.
{% enddocs %}

View File

@ -0,0 +1,5 @@
{% docs invocation_id %}
A job ID to identify the run that last modified a record.
{% enddocs %}

View File

@ -0,0 +1,5 @@
{% docs maa %}
Monthly Active Accounts (wallets), as determined by transaction signers.
{% enddocs %}

View File

@ -0,0 +1,5 @@
{% docs modified_timestamp %}
The timestamp at which this record was last modified by an internal process.
{% enddocs %}

View File

@ -0,0 +1,5 @@
{% docs new_maas %}
Monthly Active Users, whose first tranaction occurred in the preceding 30 days.
{% enddocs %}

View File

@ -0,0 +1,5 @@
{% docs returning_maas %}
Monthly active accounts, who are not defined as new.
{% enddocs %}

View File

@ -1,5 +1,7 @@
{{ config(
materialized = 'incremental',
incremental_stratege = 'merge',
merge_exclude_columns = ["inserted_timestamp"],
unique_key = 'address',
post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION",
tags = ['atlas']
@ -22,7 +24,7 @@ WITH txs AS (
{% if var("MANUAL_FIX") %}
{{ partition_load_manual('no_buffer') }}
{% else %}
{{ incremental_load_filter('_inserted_timestamp') }}
{{ incremental_load_filter('_inserted_timestamp') }}
{% endif %}
),
FINAL AS (
@ -37,7 +39,13 @@ FINAL AS (
1
)
SELECT
*
address,
first_tx_timestamp,
first_tx_block_id,
_inserted_timestamp,
SYSDATE() AS inserted_timestamp,
SYSDATE() AS modified_timestamp,
'{{ invocation_id }}' AS invocation_id
FROM
FINAL qualify ROW_NUMBER() over (
PARTITION BY address

View File

@ -0,0 +1,44 @@
version: 2
models:
- name: silver__atlas_address_first_action
description: |-
Parses transactions table for the block number and timestamp of a wallets first signed transaction.
columns:
- name: address
description: "{{ doc('address') }}"
tests:
- not_null
- unique
- name: first_tx_timestamp
description: "{{ doc('block_timestamp')}}"
tests:
- not_null
- name: first_tx_block_id
description: "{{ doc('block_id') }}"
tests:
- not_null
- name: _inserted_timestamp
description: "{{ doc('_inserted_timestamp') }}"
tests:
- name: not_null_silver__atlas_address_first_action_INSERTED_TIMESTAMP_
test_name: not_null
- name: inserted_timestamp
description: "{{ doc('inserted_timestamp') }}"
tests:
- not_null
- name: modified_timestamp
description: "{{ doc('modified_timestamp') }}"
tests:
- not_null
- name: invocation_id
description: "{{ doc('invocation_id') }}"
tests:
- not_null

View File

@ -27,7 +27,7 @@ WHERE
AND date_day < SYSDATE() :: DATE
{% else %}
WHERE
date_day BETWEEN '2020-07-21'
date_day BETWEEN '2020-07-22'
AND SYSDATE() :: DATE
{% endif %}
),

View File

@ -0,0 +1,49 @@
version: 2
models:
- name: silver__atlas_near_maa
description: |-
Monthly Active Accounts (wallets) on NEAR, including new and returning wallets, calculated over a rolling 30 day window. An active account, here, is defined as the signing of at least one transaction.
columns:
- name: active_day
description: "{{ doc('active_day') }}"
tests:
- not_null
- unique
- name: maa
description: "{{ doc('maa')}}"
tests:
- not_null
- name: new_maas
description: "{{ doc('new_maas') }}"
tests:
- not_null
- name: returning_maas
description: "{{ doc('returning_maas') }}"
tests:
- not_null
- name: _inserted_timestamp
description: "{{ doc('_inserted_timestamp') }}"
tests:
- name: not_null_silver__atlas_near_maa_INSERTED_TIMESTAMP_
test_name: not_null
- name: inserted_timestamp
description: "{{ doc('inserted_timestamp') }}"
tests:
- not_null
- name: modified_timestamp
description: "{{ doc('modified_timestamp') }}"
tests:
- not_null
- name: invocation_id
description: "{{ doc('invocation_id') }}"
tests:
- not_null