diff --git a/models/descriptions/all_transfers.md b/models/descriptions/all_transfers.md new file mode 100644 index 0000000..febb7d0 --- /dev/null +++ b/models/descriptions/all_transfers.md @@ -0,0 +1,5 @@ +{% docs all_transfers %} + +"The total count of 'nft_transfer' transactions." + +{% enddocs %} diff --git a/models/descriptions/mints_count.md b/models/descriptions/mints_count.md new file mode 100644 index 0000000..28c44da --- /dev/null +++ b/models/descriptions/mints_count.md @@ -0,0 +1,5 @@ +{% docs mint_count %} + +"The count of transactions where the method_name indicates a minting event rather than a transfer." + +{% enddocs %} diff --git a/models/descriptions/owner_count.md b/models/descriptions/owner_count.md new file mode 100644 index 0000000..b4a72f3 --- /dev/null +++ b/models/descriptions/owner_count.md @@ -0,0 +1,5 @@ +{% docs owner_count %} + +"The count of distinct owners that have interacted with the receiver's tokens." + +{% enddocs %} diff --git a/models/descriptions/token_name.md b/models/descriptions/token_name.md deleted file mode 100644 index e69de29..0000000 diff --git a/models/descriptions/tokens_count.md b/models/descriptions/tokens_count.md new file mode 100644 index 0000000..9d1f3b6 --- /dev/null +++ b/models/descriptions/tokens_count.md @@ -0,0 +1,5 @@ +{% docs tokens_count %} + +"The count of unique tokens that have been received by the receiver_id." + +{% enddocs %} diff --git a/models/gold/atlas/atlas__fact_nft_30_trailing.sql b/models/gold/atlas/atlas__fact_nft_30_trailing.sql new file mode 100644 index 0000000..c8b404e --- /dev/null +++ b/models/gold/atlas/atlas__fact_nft_30_trailing.sql @@ -0,0 +1,17 @@ +{{ config( + materialized = 'view', + secure = false, + tags = ['atlas'] +) }} + + +WITH 30_trailing AS ( + SELECT + day, + txns + FROM {{ ref('silver__atlas_nft_transactions') }} +) + +SELECT + * +FROM 30_trailing \ No newline at end of file diff --git a/models/gold/atlas/atlas__fact_nft_30_trailing.yml b/models/gold/atlas/atlas__fact_nft_30_trailing.yml new file mode 100644 index 0000000..6a97e75 --- /dev/null +++ b/models/gold/atlas/atlas__fact_nft_30_trailing.yml @@ -0,0 +1,13 @@ +version: 2 + +models: + - name: atlas__fact_nft_30_trailing + description: |- + Summary of NFT transactions from the 'silver__atlas_nft_transactions' table. It provides a daily count of transactions, accounting for a 29-day lookback period for each day within the specified date range. + + columns: + - name: day + description: "{{ doc('date')}}" + + - name: txns + description: "{{ doc('tx_count')}}" diff --git a/models/gold/atlas/atlas__fact_nft_detailed.sql b/models/gold/atlas/atlas__fact_nft_detailed.sql new file mode 100644 index 0000000..091978d --- /dev/null +++ b/models/gold/atlas/atlas__fact_nft_detailed.sql @@ -0,0 +1,22 @@ +{{ config( + materialized = 'view', + secure = false, + tags = ['atlas'] +) }} + + +WITH nft_detailed AS ( + SELECT + day, + receiver_id, + tokens, + all_transfers, + owners, + transactions, + mints + FROM {{ ref('silver__atlas_nft_detailed') }} +) + +SELECT + * +FROM nft_detailed \ No newline at end of file diff --git a/models/gold/atlas/atlas__fact_nft_detailed.yml b/models/gold/atlas/atlas__fact_nft_detailed.yml new file mode 100644 index 0000000..c49582b --- /dev/null +++ b/models/gold/atlas/atlas__fact_nft_detailed.yml @@ -0,0 +1,31 @@ +version: 2 + +models: + - name: atlas__fact_nft_detailed + description: |- + Oveeview of NFT transactions in NEAR. + +columns: + - name: action_id + description: "A unique identifier for the action, constructed as a concatenation of the day and receiver_id." + + - name: day + description: "{{ doc('date')}}" + + - name: receiver_id + description: "{{ doc('tx_receiver')}}" + + - name: tokens + description: "{{ doc('tokens_count')}}" + + - name: all_transfers + description: "{{ doc('all_transfers')}}" + + - name: owners + description: "{{ doc('owner_count')}}" + + - name: transactions + description: "{{ doc('tx_count')}}" + + - name: mints + description: "{{ doc('mint_count')}}" diff --git a/models/gold/atlas/atlas__fact_nft_table.sql b/models/gold/atlas/atlas__fact_nft_table.sql new file mode 100644 index 0000000..b20078c --- /dev/null +++ b/models/gold/atlas/atlas__fact_nft_table.sql @@ -0,0 +1,23 @@ + +{{ config( + materialized = 'view', + secure = false, + tags = ['atlas'] +) }} + +WITH nft_data AS ( + SELECT + receiver_id, + tokens, + ransfers_24h, + transfers_3d, + all_transfers, + owners, + transactions, + mints + FROM {{ ref('silver__atlas_nft_table') }} +) + +select + * +from nft_data \ No newline at end of file diff --git a/models/gold/atlas/atlas__fact_nft_table.yml b/models/gold/atlas/atlas__fact_nft_table.yml new file mode 100644 index 0000000..fee7cd3 --- /dev/null +++ b/models/gold/atlas/atlas__fact_nft_table.yml @@ -0,0 +1,31 @@ +version: 2 + +models: + - name: atlas__fact_nft_table + description: |- + NFT transaction activities by receiver_id. It includes counts of unique tokens, transfers within the last 24 hours and 3 days, all transfers, unique owners, total transactions, and minting events. + + columns: + - name: receiver_id + description: "{ { doc('receiver_id')}}" + + - name: tokens + description: "{{ doc('tokens_count')}}" + + - name: transfers_24h + description: "The count of 'nft_transfer' transactions that occurred in the last 24 hours." + + - name: transfers_3d + description: "The count of 'nft_transfer' transactions that occurred in the last 3 days." + + - name: all_transfers + description: "{{ doc('all_transfers')}}" + + - name: owners + description: "{{ doc('owner_count')}}" + + - name: transactions + description: "{{ doc('tx_count')}}" + + - name: mints + description: "{{ doc('mint_count')} \ No newline at end of file diff --git a/models/silver/atlas/silver__atlas_mma.sql b/models/silver/atlas/silver__atlas_mma.sql deleted file mode 100644 index f08de40..0000000 --- a/models/silver/atlas/silver__atlas_mma.sql +++ /dev/null @@ -1,38 +0,0 @@ -{{ config( - materialized = 'incremental', - unique_key = 'day', - incremental_strategy = 'delete+insert', - tags = ['atlas'] -) }} - -WITH date_range AS ( - SELECT - date_day as day - FROM {{ ref('silver__dates') }} - WHERE - {% if is_incremental() %} - date_day >= SYSDATE() - INTERVAL '3 DAY' - {% else %} - date_day >= '2021-01-01' -- first day of data - {% endif %} - AND date_day <= SYSDATE()::DATE -) - - -SELECT day, - COUNT(DISTINCT tx_signer) - COUNT(DISTINCT CASE WHEN first_tx >= day - INTERVAL '30 Days' AND first_tx < day THEN wallet END) AS Returning_MAAs, - COUNT(DISTINCT CASE WHEN first_tx >= day - INTERVAL '30 Days' AND first_tx < day THEN wallet END) AS New_MAAs, - COUNT(DISTINCT tx_signer) AS MAAs -FROM date_range a -LEFT OUTER JOIN (SELECT DISTINCT tx_signer, block_timestamp::date AS active_day - FROM {{ ref('silver__streamline_transactions_final') }}) b - ON active_day >= day - INTERVAL '30 DAYS' - AND active_day < day -JOIN (SELECT tx_signer AS wallet, MIN(block_timestamp) AS first_tx FROM {{ ref('silver__streamline_transactions_final') }} tr GROUP BY 1) c - ON b.tx_signer = c.wallet -GROUP BY 1 -ORDER BY 1 DESC - - --- 4.20 Mins all --- 2.5 mins incremental