maybeyonasSquiggle Features : Start Color
    Updated 2021-08-31
    with squiggles as(
    select *
    from
    ethereum.nft_metadata
    where
    token_metadata:collection_name::string = 'Chromie Squiggle by Snowfro'
    ),
    info as (
    select
    created_at_timestamp as time,
    token_id as id,
    token_metadata:features as fts
    from squiggles
    ),
    params as(
    select time,id,--fts,
    -- array_size(fts),
    case when array_size(fts) = 9 then concat(fts[0],':',fts[1]) when array_size(fts) = 8 then fts[0] else 'Normal' end as type,
    to_decimal(case when array_size(fts) = 9 then (split(fts[2],':')[1]) when array_size(fts) = 8 then (split(fts[1],':')[1]) else (split(fts[0],':')[1]) end) as start_color,
    to_decimal(case when array_size(fts) = 9 then (split(fts[3],':')[1]) when array_size(fts) = 8 then (split(fts[2],':')[1]) else (split(fts[1],':')[1]) end) as end_color,
    to_decimal(case when array_size(fts) = 9 then (split(fts[4],':')[1]) when array_size(fts) = 8 then (split(fts[3],':')[1]) else (split(fts[2],':')[1]) end) as color_spread,
    case when array_size(fts) = 9 then (split(fts[5],':')[1]) when array_size(fts) = 8 then (split(fts[4],':')[1]) else (split(fts[3],':')[1]) end as color_direction,
    to_decimal(case when array_size(fts) = 9 then (split(fts[6],':')[1]) when array_size(fts) = 8 then (split(fts[5],':')[1]) else (split(fts[4],':')[1]) end) as height,
    to_decimal(case when array_size(fts) = 9 then (split(fts[7],':')[1]) when array_size(fts) = 8 then (split(fts[6],':')[1]) else (split(fts[5],':')[1]) end) as segments,
    to_decimal(case when array_size(fts) = 9 then (split(fts[8],':')[1]) when array_size(fts) = 8 then (split(fts[7],':')[1]) else (split(fts[6],':')[1]) end) as steps
    from info
    where fts is not null
    ),
    start_color as(
    select start_color, count(id) as n, 'start_color' as param from params group by start_color
    order by start_color desc
    )

    select * from start_color
    Run a query to Download Data