openego / eTraGo

Optimization of flexibility options for transmission grids based on PyPSA
GNU Affero General Public License v3.0
30 stars 13 forks source link

Dev failing when importing scenario data #728

Closed CarlosEpia closed 4 months ago

CarlosEpia commented 4 months ago

eTraGo is failing with the next error message:

File ~/env/etrago_pr_710/lib/python3.10/site-packages/spyder_kernels/py3compat.py:356 in compat_exec exec(code, globals, locals)

File ~/git/eTraGo/etrago/appl.py:770 etrago = run_etrago(args, json_path=None)

File ~/git/eTraGo/etrago/appl.py:678 in run_etrago etrago.build_network_from_db()

File ~/git/eTraGo/etrago/tools/network.py:377 in build_network_from_db self.scenario = NetworkScenario(

File ~/git/eTraGo/etrago/tools/io.py:129 in init self.configure_timeindex()

File ~/git/eTraGo/etrago/tools/io.py:159 in configure_timeindex tr = saio.as_pandas(

File ~/env/etrago_pr_710/lib/python3.10/site-packages/saio.py:181 in as_pandas df = pd.read_sql_query(query.statement, query.session.bind,

File ~/env/etrago_pr_710/lib/python3.10/site-packages/pandas/io/sql.py:526 in read_sql_query return pandas_sql.read_query(

File ~/env/etrago_pr_710/lib/python3.10/site-packages/pandas/io/sql.py:2739 in read_query cursor = self.execute(sql, params)

File ~/env/etrago_pr_710/lib/python3.10/site-packages/pandas/io/sql.py:2671 in execute raise TypeError("Query must be a string unless using sqlalchemy.")

TypeError: Query must be a string unless using sqlalchemy.

CarlosEpia commented 4 months ago

Update: The last package version that was modified was pypsa. Installing eTraGo using the previous version, the function build_network_from_db() works normally.

ClaraBuettner commented 4 months ago

I am quite sure that the error is not related to pypsa for several reasons:

Was any other package downgraded when you downgraded pypsa?

Edit: It seems to be related to pandas, when I downgrade it to <2.2 it works as expected.