0 votes
817 views
Hello,

I want to replace all electricity processes in my current openLCA database with a new electricity process (that reflects a 100% renewable energy future). The bulk replace method is not feasible in openLCA because I would have to select each electricity process individually and there are several hundred I want to replace.

Is there a way to replace the processes in the database by using the Python console in openLCA? I have tried multiple different approaches in Python but I wasn't able to replace the processes. Nor was I able to replace the exchanges/flows of the old processes with the exchanges/flows of the new process.

Is there a way for such a bulk replacement of processes in Python in openLCA? Or maybe using SQL? Thank you very much for your help in advance.
in openLCA by (160 points)

1 Answer

+1 vote
by (114k points)
edited by
 
Best answer

Do you mean, change the default providers?

Update tbl_exchanges set f_provider = (select id from tbl_processes where ref_id = 'here the ref_id of your process') where f_default_provider in (select id from tbl_processes where name like 'and here your names that you want to replace%')

This of cource can change your database entirely, so make a backup first. You can also ask us for more formal advice, there are also more possibilities (filter the processes where the replacement is done, e.g.). Good luck!

Andreas

- afterthought: this assumes that the existing product is provided by the new process, which you should check too

by (114k points)
ah indeed, thank you; I will edit the post, I wrote the query from memory and that was indeed incorrect. Thanks again!
...