· last year · Dec 17, 2023, 09:56 AM
1drop table if exists kdz17.etl_load_weather_facts_00;
2create table if not exists kdz17.etl_load_weather_facts_00 as
3select
4 min(loaded_ts) as ts1,
5 max(loaded_ts) as ts2
6from kdz17.src_weather_facts
7where loaded_ts > coalesce((select max(loaded_ts) from kdz17.etl_weather_facts), '1970-01-01');
8
9drop table if exists kdz17.etl_load_weather_facts_01;
10create table if not exists kdz17.etl_load_weather_facts_01 as
11select distinct
12 icao_code,
13 local_datetime,
14 t_air_temperature,
15 p0_sea_lvl,
16 p_station_lvl,
17 u_humidity,
18 dd_wind_direction,
19 ff_wind_speed,
20 ff10_max_gust_value,
21 ww_present,
22 ww_recent,
23 c_total_clouds,
24 vv_horizontal_visibility,
25 td_temperature_dewpoint,
26 loaded_ts
27from kdz17.src_weather_facts, kdz17.etl_load_weather_facts_00
28where loaded_ts between ts1 and ts2;