diff --git a/src/egon/data/datasets/pypsaeur/__init__.py b/src/egon/data/datasets/pypsaeur/__init__.py index 3e909a236..27d5d445b 100755 --- a/src/egon/data/datasets/pypsaeur/__init__.py +++ b/src/egon/data/datasets/pypsaeur/__init__.py @@ -43,7 +43,7 @@ class RunPypsaEur(Dataset): def __init__(self, dependencies): super().__init__( name="SolvePypsaEur", - version="0.0.7", + version="0.0.8", dependencies=dependencies, tasks=( execute, @@ -357,23 +357,28 @@ def clean_database(): WHERE "bus0" IN ( SELECT bus_id FROM grid.egon_etrago_bus WHERE country != 'DE' - AND scn_name = '{scn_name}') + AND scn_name = '{scn_name}' + AND bus_id NOT IN (SELECT bus_i FROM osmtgmod_results.bus_data)) AND "bus1" IN ( SELECT bus_id FROM grid.egon_etrago_bus WHERE country != 'DE' - AND scn_name = '{scn_name}') + AND scn_name = '{scn_name}' + AND bus_id NOT IN (SELECT bus_i FROM osmtgmod_results.bus_data)) ); + DELETE FROM {"grid.egon_etrago_" + comp} WHERE scn_name = '{scn_name}' AND "bus0" IN ( SELECT bus_id FROM grid.egon_etrago_bus WHERE country != 'DE' - AND scn_name = '{scn_name}') + AND scn_name = '{scn_name}' + AND bus_id NOT IN (SELECT bus_i FROM osmtgmod_results.bus_data)) AND "bus1" IN ( SELECT bus_id FROM grid.egon_etrago_bus WHERE country != 'DE' - AND scn_name = '{scn_name}') + AND scn_name = '{scn_name}' + AND bus_id NOT IN (SELECT bus_i FROM osmtgmod_results.bus_data)) ;""" )