From 29a2a32054da4a01e61e0c35b59eedc19e88dc63 Mon Sep 17 00:00:00 2001 From: forgash_ Date: Mon, 13 Nov 2023 15:25:49 -0700 Subject: [PATCH] ymls and gold view --- models/descriptions/active_day.md | 5 +++ models/descriptions/id.md | 5 +++ models/descriptions/inserted_timestamp.md | 5 +++ models/descriptions/invocation_id.md | 5 +++ models/descriptions/maa.md | 5 +++ models/descriptions/modified_timestamp.md | 5 +++ models/gold/atlas/atlas__fact_maas.sql | 13 +++++++ models/gold/atlas/atlas__fact_maas.yml | 34 ++++++++++++++++ models/gold/{ => core}/core__fact_blocks.sql | 0 models/gold/{ => core}/core__fact_blocks.yml | 0 models/gold/{ => core}/core__fact_logs.sql | 0 models/gold/{ => core}/core__fact_logs.yml | 0 .../gold/{ => core}/core__fact_receipts.sql | 0 .../gold/{ => core}/core__fact_receipts.yml | 0 .../{ => core}/core__fact_transactions.sql | 0 .../{ => core}/core__fact_transactions.yml | 0 models/silver/atlas/silver__atlas_maa.sql | 8 +++- models/silver/atlas/silver__atlas_maa.yml | 39 +++++++++++++++++++ 18 files changed, 123 insertions(+), 1 deletion(-) create mode 100644 models/descriptions/active_day.md create mode 100644 models/descriptions/id.md create mode 100644 models/descriptions/inserted_timestamp.md create mode 100644 models/descriptions/invocation_id.md create mode 100644 models/descriptions/maa.md create mode 100644 models/descriptions/modified_timestamp.md create mode 100644 models/gold/atlas/atlas__fact_maas.sql create mode 100644 models/gold/atlas/atlas__fact_maas.yml rename models/gold/{ => core}/core__fact_blocks.sql (100%) rename models/gold/{ => core}/core__fact_blocks.yml (100%) rename models/gold/{ => core}/core__fact_logs.sql (100%) rename models/gold/{ => core}/core__fact_logs.yml (100%) rename models/gold/{ => core}/core__fact_receipts.sql (100%) rename models/gold/{ => core}/core__fact_receipts.yml (100%) rename models/gold/{ => core}/core__fact_transactions.sql (100%) rename models/gold/{ => core}/core__fact_transactions.yml (100%) create mode 100644 models/silver/atlas/silver__atlas_maa.yml diff --git a/models/descriptions/active_day.md b/models/descriptions/active_day.md new file mode 100644 index 0000000..959ab0a --- /dev/null +++ b/models/descriptions/active_day.md @@ -0,0 +1,5 @@ +{% docs active_day %} + +Date of activity. + +{% enddocs %} diff --git a/models/descriptions/id.md b/models/descriptions/id.md new file mode 100644 index 0000000..38c401a --- /dev/null +++ b/models/descriptions/id.md @@ -0,0 +1,5 @@ +{% docs id %} + +A unique identifier for the record. + +{% enddocs %} diff --git a/models/descriptions/inserted_timestamp.md b/models/descriptions/inserted_timestamp.md new file mode 100644 index 0000000..94447a4 --- /dev/null +++ b/models/descriptions/inserted_timestamp.md @@ -0,0 +1,5 @@ +{% docs inserted_timestamp %} + +The timestamp at which the record was initially created and inserted into this table. + +{% enddocs %} diff --git a/models/descriptions/invocation_id.md b/models/descriptions/invocation_id.md new file mode 100644 index 0000000..64a03b7 --- /dev/null +++ b/models/descriptions/invocation_id.md @@ -0,0 +1,5 @@ +{% docs invocation_id %} + +A job ID to identify the run that last modified a record. + +{% enddocs %} diff --git a/models/descriptions/maa.md b/models/descriptions/maa.md new file mode 100644 index 0000000..965c402 --- /dev/null +++ b/models/descriptions/maa.md @@ -0,0 +1,5 @@ +{% docs maa %} + +Monthly Active Accounts (wallets), as determined by transaction signers. + +{% enddocs %} diff --git a/models/descriptions/modified_timestamp.md b/models/descriptions/modified_timestamp.md new file mode 100644 index 0000000..abda32e --- /dev/null +++ b/models/descriptions/modified_timestamp.md @@ -0,0 +1,5 @@ +{% docs modified_timestamp %} + +The timestamp at which this record was last modified by an internal process. + +{% enddocs %} diff --git a/models/gold/atlas/atlas__fact_maas.sql b/models/gold/atlas/atlas__fact_maas.sql new file mode 100644 index 0000000..cc21a81 --- /dev/null +++ b/models/gold/atlas/atlas__fact_maas.sql @@ -0,0 +1,13 @@ +{{ config( + materialized = 'view', + tags = ['atlas'] +) }} + +SELECT + atlas_maa_id AS fact_maas_id, + day, + maa, + inserted_timestamp, + modified_timestamp +FROM + {{ ref('silver__atlas_maa') }} diff --git a/models/gold/atlas/atlas__fact_maas.yml b/models/gold/atlas/atlas__fact_maas.yml new file mode 100644 index 0000000..abdf8e0 --- /dev/null +++ b/models/gold/atlas/atlas__fact_maas.yml @@ -0,0 +1,34 @@ +version: 2 + +models: + - name: atlas__fact_maas + description: |- + Monthly Active Accounts (wallets) on Aurora, calculated over a rolling 30 day window. An active account, here, is defined as the signing of at least one transaction. + + columns: + - name: fact_maas_id + description: "{{ doc('id') }}" + tests: + - not_null + - unique + + - name: day + description: "{{ doc('active_day') }}" + tests: + - not_null + - unique + + - name: maa + description: "{{ doc('maa')}}" + tests: + - not_null + + - name: inserted_timestamp + description: "{{ doc('inserted_timestamp') }}" + tests: + - not_null + + - name: modified_timestamp + description: "{{ doc('modified_timestamp') }}" + tests: + - not_null diff --git a/models/gold/core__fact_blocks.sql b/models/gold/core/core__fact_blocks.sql similarity index 100% rename from models/gold/core__fact_blocks.sql rename to models/gold/core/core__fact_blocks.sql diff --git a/models/gold/core__fact_blocks.yml b/models/gold/core/core__fact_blocks.yml similarity index 100% rename from models/gold/core__fact_blocks.yml rename to models/gold/core/core__fact_blocks.yml diff --git a/models/gold/core__fact_logs.sql b/models/gold/core/core__fact_logs.sql similarity index 100% rename from models/gold/core__fact_logs.sql rename to models/gold/core/core__fact_logs.sql diff --git a/models/gold/core__fact_logs.yml b/models/gold/core/core__fact_logs.yml similarity index 100% rename from models/gold/core__fact_logs.yml rename to models/gold/core/core__fact_logs.yml diff --git a/models/gold/core__fact_receipts.sql b/models/gold/core/core__fact_receipts.sql similarity index 100% rename from models/gold/core__fact_receipts.sql rename to models/gold/core/core__fact_receipts.sql diff --git a/models/gold/core__fact_receipts.yml b/models/gold/core/core__fact_receipts.yml similarity index 100% rename from models/gold/core__fact_receipts.yml rename to models/gold/core/core__fact_receipts.yml diff --git a/models/gold/core__fact_transactions.sql b/models/gold/core/core__fact_transactions.sql similarity index 100% rename from models/gold/core__fact_transactions.sql rename to models/gold/core/core__fact_transactions.sql diff --git a/models/gold/core__fact_transactions.yml b/models/gold/core/core__fact_transactions.yml similarity index 100% rename from models/gold/core__fact_transactions.yml rename to models/gold/core/core__fact_transactions.yml diff --git a/models/silver/atlas/silver__atlas_maa.sql b/models/silver/atlas/silver__atlas_maa.sql index 4bab596..36d1ae6 100644 --- a/models/silver/atlas/silver__atlas_maa.sql +++ b/models/silver/atlas/silver__atlas_maa.sql @@ -1,6 +1,9 @@ {{ config( materialized = 'incremental', - unique_key = 'day' + incremental_stratege = 'merge', + merge_exclude_columns = ["inserted_timestamp"], + unique_key = 'day', + tags = ['atlas'] ) }} WITH dates AS ( @@ -64,6 +67,9 @@ FINAL AS ( 1 DESC ) SELECT + {{ dbt_utils.generate_surrogate_key( + ['day'] + ) }} AS atlas_maa_id, DAY, maa, SYSDATE() AS inserted_timestamp, diff --git a/models/silver/atlas/silver__atlas_maa.yml b/models/silver/atlas/silver__atlas_maa.yml new file mode 100644 index 0000000..644dc2e --- /dev/null +++ b/models/silver/atlas/silver__atlas_maa.yml @@ -0,0 +1,39 @@ +version: 2 + +models: + - name: silver__atlas_maa + description: |- + Monthly Active Accounts (wallets) on Aurora, calculated over a rolling 30 day window. An active account, here, is defined as the signing of at least one transaction. + + columns: + - name: atlas_maa_id + description: "{{ doc('id') }}" + tests: + - not_null + - unique + + - name: day + description: "{{ doc('active_day') }}" + tests: + - not_null + - unique + + - name: maa + description: "{{ doc('maa')}}" + tests: + - 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