AN-4203/ufc strike metadata (#230)

* ufc strike metadata, plus organized nft folder better

* upd db tag on gold

* upd col name to serial number

* del listing id

* add back listing id
This commit is contained in:
Jack Forgash 2023-11-20 16:26:39 -07:00 committed by GitHub
parent 821214294c
commit 121c3e6a2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
37 changed files with 206 additions and 3 deletions

View File

@ -0,0 +1,5 @@
{% docs _filename %}
The filename of the source of the data
{% 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 modified_timestamp %}
The timestamp at which this record was last modified by an internal process.
{% enddocs %}

View File

@ -0,0 +1,23 @@
{{ config(
materialized = 'view',
meta={
'database_tags':{
'table': {
'PURPOSE': 'NFT, UFCSTRIKE'
}
}
},
tags = ['scheduled_non_core']
) }}
SELECT
nft_id,
serial_number,
listing_id,
set_name,
metadata,
inserted_timestamp,
modified_timestamp,
invocation_id
FROM
{{ ref('silver__nft_ufc_strike_metadata') }}

View File

@ -0,0 +1,43 @@
version: 2
models:
- name: nft__dim_ufc_strike_metadata
description: |-
UFC Strike NFT Metadata
columns:
- name: NFT_ID
description: "{{ doc('nft_id')}}"
tests:
- not_null
- unique
- name: SERIAL_NUMBER
description: "{{ doc('serial_number')}}"
tests:
- not_null
- name: LISTING_ID
description: "{{ doc('listing_id')}}"
tests:
- not_null
- name: SET_NAME
description: "{{ doc('set_name')}}"
tests:
- not_null
- name: METADATA
description: "{{ doc('metadata')}}"
tests:
- not_null
- name: INSERTED_TIMESTAMP
description: "{{doc('inserted_timestamp')}}"
tests:
- not_null
- name: MODIFIED_TIMESTAMP
description: "{{doc('modified_timestamp')}}"
tests:
- not_null

View File

@ -0,0 +1,5 @@
# On-chain Metadata
A number of projects on Flow post moment metadata to the chain when a moment is minted. This occurrs over a number of different categories. A moment typically is part of a set, and edition, and/or a series. A moment itself is a representation of a play in some sport or event. Thus, a moment may have a play id, set id, series id, edition id, and more. So, for a full representation of a moment's metadata, each of these components is required.
The models in this folder were built in at the end of 2022/early 2023 to parse a few projects that had begun to store metadata on chain. As more projects move to this approach, these models will be updated.

View File

@ -0,0 +1,49 @@
{{ config(
materialized = 'incremental',
incremental_strategy = 'merge',
unique_key = ['nft_id'],
merge_exclude_columns = ["inserted_timestamp"],
tags = ['scheduled_non_core']
) }}
WITH metadata AS (
SELECT
token_id,
edition,
owner,
listing_id,
set_name,
metadata,
_inserted_timestamp,
_filename
FROM
{{ source(
'flow_bronze',
'ufc_strike_metadata'
) }}
{% if is_incremental() %}
WHERE
_inserted_timestamp >= (
SELECT
MAX(_inserted_timestamp)
FROM
{{ this }}
)
{% endif %}
)
SELECT
token_id AS nft_id,
edition AS serial_number,
owner,
listing_id,
set_name,
metadata,
_inserted_timestamp,
_filename,
SYSDATE() AS inserted_timestamp,
SYSDATE() AS modified_timestamp,
'{{invocation_id}}' AS invocation_id
FROM
metadata

View File

@ -0,0 +1,59 @@
version: 2
models:
- name: silver__nft_ufc_strike_metadata
description: |-
UFC Strike NFT Metadata
columns:
- name: NFT_ID
description: "{{ doc('nft_id')}}"
tests:
- not_null
- unique
- name: SERIAL_NUMBER
description: "{{ doc('serial_number')}}"
tests:
- not_null
- name: OWNER
description: "The last known owner of this NFT at time of data pull"
tests:
- not_null
- name: LISTING_ID
description: "{{ doc('listing_id')}}"
tests:
- not_null
- name: SET_NAME
description: "{{ doc('set_name')}}"
tests:
- not_null
- name: METADATA
description: "{{ doc('metadata')}}"
tests:
- not_null
- name: _INSERTED_TIMESTAMP
description: "{{doc('_inserted_timestamp')}}"
- name: _FILENAME
description: "{{doc('_filename')}}"
- 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

@ -125,12 +125,16 @@ sources:
- name: TRANSACTION_RESULTS_MAINNET_21
- name: TRANSACTION_RESULTS_MAINNET_22
- name: crosschain_silver
database: crosschain
schema: silver
tables:
- name: hourly_prices_coin_gecko
- name: hourly_prices_coin_market_cap
- name: number_sequence
- name: number_sequence
- name: flow_bronze
database: flow
schema: bronze
tables:
- name: ufc_strike_metadata