-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
flexmeasures delete prognoses fails with TypeError #1092
Comments
Indeed, above that line we have This part of the SQLAlchemy documentation suggests to use
Are you able to try out if this fixes your problem? |
The code change removed the error but the result I got was I do have forecast so this is not the behavior I expected. |
Maybe the previous run had already deleted them? |
No I am simulating back in time so my horizon is negative. I think that is why nothing got deleted. |
Ah, yes that is different, then they count as measurements. When you create beliefs, you can set the horizon which fits the assumption of the simulation. We are using FlexMeasures to simulate internally, as well. For deleting whatever beliefs of a sensor (or even per asset), try However, that code might also exhibit the same problem you point out in this issue (namely in
Do you want to add the fix you tested into a PR? That would be very welcome (and make you a FlexMeasures contributor :)) - but I can also address it myself. Thanks for pointing it out in any case! |
Let me test a little more then I try to address the PR. |
After move to SQLAlchemy 2 the code num_forecasts_deleted = db.session.execute(query) Does not work as it use to. Changed code to use .rowcount There are more places that has same issues but I do not have test cases so I only fixed this one.
…lete-prognoses-fails-with-TypeError-
I am on v0.21
When I call
flexmeasures delete prognoses --sensor 267
I get this error
File "/opt/anaconda3/envs/flexmeasures-venv/lib/python3.10/site-packages/flexmeasures/cli/data_delete.py", line 224, in delete_prognoses
depopulate_prognoses(db, sensor_id)
File "/opt/anaconda3/envs/flexmeasures-venv/lib/python3.10/site-packages/flexmeasures/data/transactional.py", line 38, in wrap
db_function(*args, **kwargs)
File "/opt/anaconda3/envs/flexmeasures-venv/lib/python3.10/site-packages/flexmeasures/data/scripts/data_gen.py", line 351, in depopulate_prognoses
click.echo("Deleted %d forecasts (ex-ante beliefs)" % num_forecasts_deleted)
TypeError: %d format: a real number is required, not CursorResult
The text was updated successfully, but these errors were encountered: