Skip to content

Commit

Permalink
AN-4203/ufc strike metadata (#230)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
forgxyz authored Nov 20, 2023
1 parent 8212142 commit 121c3e6
Show file tree
Hide file tree
Showing 37 changed files with 206 additions and 3 deletions.
5 changes: 5 additions & 0 deletions models/descriptions/_filename.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{% docs _filename %}

The filename of the source of the data

{% enddocs %}
5 changes: 5 additions & 0 deletions models/descriptions/inserted_timestamp.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{% docs inserted_timestamp %}

The timestamp at which the record was initially created and inserted into this table.

{% enddocs %}
5 changes: 5 additions & 0 deletions models/descriptions/invocation_id.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{% docs invocation_id %}

A job ID to identify the run that last modified a record.

{% enddocs %}
5 changes: 5 additions & 0 deletions models/descriptions/modified_timestamp.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{% docs modified_timestamp %}

The timestamp at which this record was last modified by an internal process.

{% enddocs %}
23 changes: 23 additions & 0 deletions models/gold/nft/nft__dim_ufc_strike_metadata.sql
Original file line number Diff line number Diff line change
@@ -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') }}
43 changes: 43 additions & 0 deletions models/gold/nft/nft__dim_ufc_strike_metadata.yml
Original file line number Diff line number Diff line change
@@ -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
5 changes: 5 additions & 0 deletions models/silver/nft/metadata/onchain/README.md
Original file line number Diff line number Diff line change
@@ -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.
File renamed without changes.
49 changes: 49 additions & 0 deletions models/silver/nft/metadata/silver__nft_ufc_strike_metadata.sql
Original file line number Diff line number Diff line change
@@ -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
59 changes: 59 additions & 0 deletions models/silver/nft/metadata/silver__nft_ufc_strike_metadata.yml
Original file line number Diff line number Diff line change
@@ -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
10 changes: 7 additions & 3 deletions models/sources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 121c3e6

Please sign in to comment.