~~~BEGIN_MAIN_SECTION~~~
[PRODUCT]
view=CSV_STATE_OF_DC_HISTORICAL_VW
~~~END_MAIN_SECTION~~~


~~~BEGIN_VERSION_SECTION~~~
[VERSION]
version=2025-11-04

[SQL_SCRIPT___DEFAULT]

create or replace view CSV_STATE_OF_DC_HISTORICAL_VW as
(
select
    SRC_CSV_STATE_OF_DC_HISTORICAL_TB.*
    ,case
        when DC like 'Ashburn%' then 'US'
        when DC like 'Phoenix%' then 'US'
        when DC like 'Boston%' then 'US'
        when DC like 'San Jose%' then 'US'
        when DC like 'Chicago%' then 'US'
        when DC like 'Seattle%' then 'US'
        when DC like 'Montreal%' then 'US'
        when DC like 'Toronto%' then 'US'
        
        when DC like 'Amsterdam%' then 'EU'
        when DC like 'Frankfurt%' then 'EU'
        when DC like 'London%' then 'EU'
        when DC like 'Newport%' then 'EU'

        when DC like 'Sydney%' then 'ASIA'
        when DC like 'Melbourne%' then 'ASIA'
        when DC like 'Tokyo%' then 'ASIA'
        when DC like 'Osaka%' then 'ASIA'
        when DC like 'Hyderabad%' then 'ASIA'
        when DC like 'Mumbai%' then 'ASIA'

        when DC like 'Classic%' then 'GENERIC'
        when DC like 'OCI%' then 'GENERIC'
        when DC like 'AMER%' then 'GENERIC'
        when DC like 'EMEA%' then 'GENERIC'
        when DC like 'JAPAC%' then 'GENERIC'
        when DC like 'NetSuite%' then 'GENERIC'
        when DC like 'Primary%' then 'GENERIC'
        when DC like 'Commerce%' then 'GENERIC'
        when DC like 'Top Customers%' then 'GENERIC'
    end REGION
    ,case
        when (ALL_MINUTES*NUMBER_OF_CUSTOMERS=0) then 1
        when (1-DOWN_MINUTES/(ALL_MINUTES*NUMBER_OF_CUSTOMERS)) between 0.9999995 and 1 then 0.999999
        else (1-DOWN_MINUTES/(ALL_MINUTES*NUMBER_OF_CUSTOMERS))
        end UPTIME
from
    SRC_CSV_STATE_OF_DC_HISTORICAL_TB
)
~~~END_VERSION_SECTION~~~