Skip to content

Commit f8a4834

Browse files
committed
speed up
1 parent 2be8f94 commit f8a4834

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

nowcasting_datamodel/read/read.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,9 @@ def get_all_gsp_ids_latest_forecast(
235235
query = query.options(joinedload(ForecastSQL.location))
236236
query = query.options(joinedload(ForecastSQL.model))
237237
query = query.options(joinedload(ForecastSQL.input_data_last_updated))
238-
query = query.options(joinedload(ForecastSQL.forecast_values))
239-
query = query.options(joinedload(ForecastSQL.forecast_values_latest))
238+
if not historic:
239+
query = query.options(joinedload(ForecastSQL.forecast_values))
240+
query = query.options(joinedload(ForecastSQL.forecast_values_latest))
240241

241242
query = query.order_by(LocationSQL.gsp_id, desc(ForecastSQL.created_utc))
242243

0 commit comments

Comments
 (0)