AN-1830/topshot nft ids (#45)

* add sales to list

* distinct

* list columns
This commit is contained in:
Jack Forgash 2022-07-28 11:35:09 -06:00 committed by GitHub
parent 1f4208dd91
commit a7cbfb04bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,14 +3,43 @@
post_hook = 'call silver.sp_bulk_get_topshot_moments_minted_metadata()'
) }}
WITH mints AS (
SELECT
event_contract,
event_data :momentID :: STRING AS moment_id
FROM
{{ ref('silver__events_final') }}
WHERE
event_contract = 'A.0b2a3299cc857e29.TopShot'
AND event_type = 'MomentMinted'
),
sales AS (
SELECT
nft_collection AS event_contract,
nft_id AS moment_id
FROM
{{ ref('silver__nft_sales') }}
WHERE
nft_collection ILIKE '%topshot%'
),
all_topshots AS (
SELECT
event_contract,
moment_id
FROM
mints
UNION
SELECT
event_contract,
moment_id
FROM
sales
)
SELECT
event_contract,
event_data :momentID :: STRING AS moment_id
DISTINCT *
FROM
{{ ref('silver__events_final') }}
WHERE
event_contract = 'A.0b2a3299cc857e29.TopShot'
AND event_type = 'MomentMinted'
all_topshots
EXCEPT
SELECT
contract,