Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- insert into kdz17.staging_weather_facts
- select distinct
- icao_code,
- TO_TIMESTAMP(local_datetime, 'DD.MM.YYYY HH24:MI'),
- t_air_temperature,
- p0_sea_lvl,
- p_station_lvl,
- u_humidity,
- dd_wind_direction,
- ff_wind_speed,
- ff10_max_gust_value,
- ww_present,
- ww_recent,
- c_total_clouds,
- vv_horizontal_visibility,
- td_temperature_dewpoint,
- loaded_ts
- from kdz17.etl_load_weather_facts_01
- on conflict (icao_code, local_datetime) do update
- set
- t_air_temperature = excluded.t_air_temperature,
- p0_sea_lvl = excluded.p0_sea_lvl,
- p_station_lvl = excluded.p_station_lvl,
- u_humidity = excluded.u_humidity,
- dd_wind_direction = excluded.dd_wind_direction,
- ff_wind_speed = excluded.ff_wind_speed,
- ff10_max_gust_value = excluded.ff10_max_gust_value,
- ww_present = excluded.ww_present,
- ww_recent = excluded.ww_recent,
- c_total_clouds = excluded.c_total_clouds,
- vv_horizontal_visibility = excluded.vv_horizontal_visibility,
- td_temperature_dewpoint = excluded.td_temperature_dewpoint,
- loaded_ts = now();
- delete from kdz17.etl_weather_facts
- where exists (select 1 from kdz17.etl_weather_facts);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement