moments to table (#87)

* moments to table

* unique key

* change nfl allday
This commit is contained in:
Jack Forgash 2022-11-17 16:37:39 -07:00 committed by GitHub
parent 06643d4fd9
commit cffac5a733
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 49 additions and 2 deletions

View File

@ -0,0 +1,47 @@
{{ config(
materialized = 'incremental',
incremental_strategy = 'delete+insert',
cluster_by = ['_inserted_timestamp::DATE'],
unique_key = "CONCAT_WS('-', tx_id, event_index)",
tags = ['nft']
) }}
WITH events AS (
SELECT
*
FROM
{{ ref('silver__events_final') }}
{% if is_incremental() %}
WHERE
_inserted_timestamp >= (
SELECT
MAX(_inserted_timestamp)
FROM
{{ this }}
)
{% endif %}
),
moment_events AS (
SELECT
*
FROM
events
WHERE
event_type IN (
'MomentPurchased',
'MomentLocked',
'MomentCreated',
'MomentNFTBurned',
'MomentListed',
'MomentDestroyed',
'MomentWithdrawn',
'MomentMinted',
'MomentNFTMinted'
)
)
SELECT
*
FROM
moment_events

View File

@ -8,7 +8,7 @@ WITH mints AS (
event_contract,
event_data :momentID :: STRING AS moment_id
FROM
{{ ref('silver__events_final') }}
{{ ref('silver__nft_moments') }}
WHERE
event_contract = 'A.0b2a3299cc857e29.TopShot'
AND event_type = 'MomentMinted'

View File

@ -8,7 +8,7 @@ WITH mints AS (
event_contract,
event_data :id :: STRING AS moment_id
FROM
{{ ref('silver__events_final') }}
{{ ref('silver__nft_moments') }}
WHERE
event_contract = 'A.e4cf4bdc1751c65d.AllDay'
AND event_type = 'MomentNFTMinted'