Advertisement
gubichas

weather3

Dec 17th, 2023
799
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. drop table if exists kdz17.etl_load_weather_facts_00;
  2. create table if not exists kdz17.etl_load_weather_facts_00 as
  3. select
  4.    min(loaded_ts) as ts1,
  5.    max(loaded_ts) as ts2
  6. from kdz17.src_weather_facts
  7. where loaded_ts > coalesce((select max(loaded_ts) from kdz17.etl_weather_facts), '1970-01-01');
  8.  
  9. drop table if exists kdz17.etl_load_weather_facts_01;
  10. create table if not exists kdz17.etl_load_weather_facts_01 as
  11. select 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
  27. from kdz17.src_weather_facts, kdz17.etl_load_weather_facts_00
  28. where loaded_ts between ts1 and ts2;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement