Auto-update: Tue Aug 6 22:21:24 PDT 2024

This commit is contained in:
sanj 2024-08-06 22:21:24 -07:00
parent e527b0e391
commit 98e9eef70a

View file

@ -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')) 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']}") debug(f"Corrected datetimes: datetime={day_data['datetime']}, sunrise={day_data['sunrise']}, sunset={day_data['sunset']}")
daily_weather_params = [ daily_weather_params = [
day_data.get('sunrise'), day_data.get('sunriseEpoch'), day_data.get('sunrise'), day_data.get('sunriseEpoch'),
day_data.get('sunset'), day_data.get('sunsetEpoch'), day_data.get('sunset'), day_data.get('sunsetEpoch'),
@ -190,21 +191,7 @@ async def store_weather_to_db(date_time: dt_datetime, weather_data: dict):
location_point location_point
] ]
debug(f"Prepared daily_weather_params: {daily_weather_params}") daily_weather_query = 'INSERT INTO dailyweather DEFAULT VALUES'
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_result = await API.execute_write_query(daily_weather_query, *daily_weather_params, table_name="dailyweather") daily_weather_result = await API.execute_write_query(daily_weather_query, *daily_weather_params, table_name="dailyweather")
if not daily_weather_result: if not daily_weather_result: