From 98e9eef70a58de39c7f26ae20e7c1ba5f94a69ad Mon Sep 17 00:00:00 2001 From: sanj <67624670+iodrift@users.noreply.github.com> Date: Tue, 6 Aug 2024 22:21:24 -0700 Subject: [PATCH] Auto-update: Tue Aug 6 22:21:24 PDT 2024 --- sijapi/routers/weather.py | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/sijapi/routers/weather.py b/sijapi/routers/weather.py index 6b8ec39..9fb16d2 100644 --- a/sijapi/routers/weather.py +++ b/sijapi/routers/weather.py @@ -168,6 +168,7 @@ async def store_weather_to_db(date_time: dt_datetime, weather_data: dict): day_data['sunset'] = await gis.dt(day_data.get('sunsetEpoch')) debug(f"Corrected datetimes: datetime={day_data['datetime']}, sunrise={day_data['sunrise']}, sunset={day_data['sunset']}") + daily_weather_params = [ day_data.get('sunrise'), day_data.get('sunriseEpoch'), day_data.get('sunset'), day_data.get('sunsetEpoch'), @@ -189,22 +190,8 @@ async def store_weather_to_db(date_time: dt_datetime, weather_data: dict): day_data.get('conditions'), stations_array, day_data.get('source'), location_point ] - - debug(f"Prepared daily_weather_params: {daily_weather_params}") - - daily_weather_query = ''' - INSERT INTO dailyweather ( - sunrise, sunriseepoch, sunset, sunsetepoch, description, - tempmax, tempmin, uvindex, winddir, windspeed, icon, last_updated, - datetime, datetimeepoch, temp, feelslikemax, feelslikemin, feelslike, - dew, humidity, precip, precipprob, precipcover, preciptype, - snow, snowdepth, windgust, pressure, cloudcover, visibility, - solarradiation, solarenergy, severerisk, moonphase, conditions, - stations, source, location - ) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21, $22, $23, $24, $25, $26, $27, $28, $29, $30, $31, $32, $33, $34, $35, $36, $37, $38) - RETURNING id - ''' - + + daily_weather_query = 'INSERT INTO dailyweather DEFAULT VALUES' daily_weather_result = await API.execute_write_query(daily_weather_query, *daily_weather_params, table_name="dailyweather") if not daily_weather_result: