You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
remote: File "/home/seita/flexmeasures-staging/flexmeasures-work/flexmeasures/data/migrations/versions/ad98460751d9_remove_obsolete_tables.py", line 42, in upgrade
remote: result = db.session.execute(
remote: File "/home/seita/.virtualenvs/bvp-staging-venv/lib/python3.8/site-packages/sqlalchemy/engine/result.py", line 1487, in scalar_one_or_none
remote: return self._only_one_row(
remote: File "/home/seita/.virtualenvs/bvp-staging-venv/lib/python3.8/site-packages/sqlalchemy/engine/result.py", line 805, in _only_one_row
remote: raise exc.MultipleResultsFound(
remote: sqlalchemy.exc.MultipleResultsFound: Multiple rows were found when one or none was required
This code doesn't seem to be able to deal with multiple rows, and was not tested well:
if inspect.has_table(table):
result = db.session.execute(
sa.text(f"SELECT 1 FROM {table};")
).scalar_one_or_none()
if result:
tables_with_data.append(table)
else:
print(f"Table {table} not found, continuing...")
...
if tables_with_data:
click.confirm(
f"The following tables still have data and will be dropped by this upgrade: {tables_with_data}. Use `flexmeasures db-ops dump` to create a backup. Are you sure you want to upgrade the database?: ",
abort=True,
)
This migration is over a year old, so the urgency is not super-high, as there are probably no other old databases around at this time.
The text was updated successfully, but these errors were encountered:
Saw this on the staging server which tried to upgrade from an older state:
This code doesn't seem to be able to deal with multiple rows, and was not tested well:
...
This migration is over a year old, so the urgency is not super-high, as there are probably no other old databases around at this time.
The text was updated successfully, but these errors were encountered: