Skip to content

Commit

Permalink
Backport PR #997: fix: Use scalars instead of scalar having limit con…
Browse files Browse the repository at this point in the history
…straint (#997)

* use scalars instead of scalar having limit constraint

Signed-off-by: Ahmad Wahid <[email protected]>

* docs: changelog entry

Signed-off-by: F.N. Claessen <[email protected]>

---------

Signed-off-by: Ahmad Wahid <[email protected]>
Signed-off-by: F.N. Claessen <[email protected]>
Co-authored-by: F.N. Claessen <[email protected]>
  • Loading branch information
Ahmad-Wahid and Flix6x committed Mar 1, 2024
1 parent 0a42fb6 commit df63082
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions documentation/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ v0.19.2 | March 1, 2024

* Upgrade timely-beliefs to enhance our main time series query and fix a database index on time series data, leading to significantly better performance [see `PR #992 <https://github.com/FlexMeasures/flexmeasures/pull/992>`_]
* Fix server error on loading the asset page for a public asset, due to a bug in the breadcrumb's sibling navigation [see `PR #991 <https://github.com/FlexMeasures/flexmeasures/pull/991>`_]
* Restore compatibility with the `flexmeasures-openweathermap plugin <https://github.com/SeitaBV/flexmeasures-openweathermap>`_ by fixing the query for the closest weather sensor to a given asset [see `PR #997 <https://github.com/FlexMeasures/flexmeasures/pull/997>`_]


v0.19.1 | February 26, 2024
Expand Down
2 changes: 1 addition & 1 deletion flexmeasures/data/models/time_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ def find_closest(
account_id=account_id_filter,
)
if n == 1:
return db.session.scalar(query.limit(1)).first()
return db.session.scalars(query.limit(1)).first()
else:
return db.session.scalars(query.limit(n)).all()

Expand Down

0 comments on commit df63082

Please sign in to comment.