Closed ccomb closed 1 year ago
After enabling vacuum, I get again this issue:
Traceback (most recent call last):
File "/home/jovyan/ecobalyse/data/import_ecoinvent.py", line 61, in <module>
main()
File "/home/jovyan/ecobalyse/data/import_ecoinvent.py", line 55, in main
import_ecoinvent()
File "/home/jovyan/ecobalyse/data/import_ecoinvent.py", line 25, in import_ecoinvent
ecoinvent.add_unlinked_flows_to_biosphere_database()
File "/opt/conda/lib/python3.11/site-packages/bw2io/importers/base_lci.py", line 420, in add_unlinked_flows_to_biosphere_database
bio.write(data)
File "/opt/conda/lib/python3.11/site-packages/bw2data/backends/base.py", line 522, in write
self._efficient_write_many_data(data)
File "/opt/conda/lib/python3.11/site-packages/bw2data/backends/base.py", line 458, in _efficient_write_many_data
self.delete(keep_params=True, warn=False)
File "/opt/conda/lib/python3.11/site-packages/bw2data/backends/base.py", line 645, in delete
sqlite3_lci_db.vacuum()
File "/opt/conda/lib/python3.11/site-packages/bw2data/sqlite.py", line 49, in vacuum
self.execute_sql("VACUUM;")
File "/opt/conda/lib/python3.11/site-packages/bw2data/sqlite.py", line 42, in execute_sql
return self.db.execute_sql(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/conda/lib/python3.11/site-packages/peewee.py", line 3249, in execute_sql
with __exception_wrapper__:
File "/opt/conda/lib/python3.11/site-packages/peewee.py", line 3019, in __exit__
reraise(new_type, new_type(exc_value, *exc_args), traceback)
File "/opt/conda/lib/python3.11/site-packages/peewee.py", line 192, in reraise
raise value.with_traceback(tb)
File "/opt/conda/lib/python3.11/site-packages/peewee.py", line 3251, in execute_sql
cursor.execute(sql, params or ())
peewee.OperationalError: cannot VACUUM from within a transaction
@ccomb What version are you using? I thought this was fixed in https://github.com/brightway-lca/brightway2-data/commit/78b21a611e6961966a073a6ad646769af4f1e42c, but maybe not.
It was fixed outside delete(), but when executing the delete() function, we might be in a transaction. I pushed a possible fix in this branch with #150
I'm using the latest, 4.0.DEV23
Your help is greatly appreciated on DEV23, but for the time being I would switch back to DEV21, both 22 and 23 are unstable and have been yanked from pypi. The refactoring out of bw_projects still needs some polishing.
:-/ Oops that's bad news, I have already switched to (a minimal fork based on) DEV23 and I am able to run the whole ecobalyse data generation without much problem
... I am experiencing problems with DEV21. AttributeError: 'SQLiteBackend' object has no attribute 'delete_data'
.. it seems this method was part of DEV22.. ?
I've moved to DEV24 and it works for my usage. Closing this issue as it is fixed with #150 @mfastudillo did you try DEV24?
no I did not. For the moment I'll stick to dev18
Sorry about all the frustration, I merged some code from others that I thought was well tested, but it wasn't integration tested by someone who knows the problem domain. The latest release (DEV24
) should be OK, it basically removed the stuff that broke.