mirror of
https://github.com/FlipsideCrypto/osmosis-models.git
synced 2026-02-06 18:06:45 +00:00
* use streamline db location for source data * use new streamline endpoints * remove limits, now controlled from streamline at runtime
44 lines
811 B
SQL
44 lines
811 B
SQL
{{ config(
|
|
materialized = 'table'
|
|
) }}
|
|
|
|
WITH base AS (
|
|
|
|
SELECT
|
|
base AS address,
|
|
NAME AS label,
|
|
symbol AS project_name,
|
|
denom_units AS raw_metadata
|
|
FROM
|
|
{{ source(
|
|
'bronze_streamline',
|
|
'asset_metadata_api'
|
|
) }}
|
|
GROUP BY
|
|
1,
|
|
2,
|
|
3,
|
|
4
|
|
)
|
|
SELECT
|
|
'osmosis' AS blockchain,
|
|
address,
|
|
'flipside' AS creator,
|
|
'token' AS label_type,
|
|
'token_contract' AS label_subtype,
|
|
label,
|
|
project_name,
|
|
raw_metadata [0] :aliases [0] :: STRING AS alias,
|
|
raw_metadata [array_size(raw_metadata)-1] :exponent :: NUMBER AS DECIMAL,
|
|
raw_metadata,
|
|
concat_ws(
|
|
'-',
|
|
address,
|
|
creator,
|
|
blockchain
|
|
) AS _unique_key
|
|
FROM
|
|
base qualify(ROW_NUMBER() over(PARTITION BY blockchain, creator, address
|
|
ORDER BY
|
|
project_name DESC)) = 1
|