[BUG] `set_time_series_active_power_predefined` creates a database engine although the time series are given as DataFrames

Open Beginner friendly
#873 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python
Domain
databases

Research direction

Read edisgo/edisgo.py around set_time_series_active_power_predefined at line 420 and the engine selection at line 603. Run tests/properties/test_properties_edisgo.py::TestTopologyAndIntegrity::test_predefined_time_series_from_dataframes_need_no_database to confirm the failure. Make engine creation happen only in branches that fetch database data; the DataFrame case should pass without calling egon_engine().

Written by the indexing model from the issue text.

Description

area: database bug priority: low

Summary

Without an engine keyword, set_time_series_active_power_predefined always calls egon_engine(), also when all time series are passed as DataFrames or come from demandlib. With an egon-data config present this opens an SSH tunnel; without database access it fails, although no data are fetched.

Where

edisgo/edisgo.py:420 set_time_series_active_power_predefined, engine = kwargs["engine"] if "engine" in kwargs else egon_engine() at edisgo.py:603.

How to reproduce

Test (strict xfail, added in #856): tests/properties/test_properties_edisgo.py::TestTopologyAndIntegrity::test_predefined_time_series_from_dataframes_need_no_database (monkeypatches egon_engine to raise and passes conventional_loads_ts=<DataFrame>).

Proposed fix

Create the engine lazily, only in the branches that read from the database.

Dominant language
Python
Stars
48
Forks
22
Avg merge
1d 7h
Merged PRs (30d)
38

Getting set up

  • No Dockerfile or Docker Compose file
  • Has a pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from openego/eDisGo

All issues in openego/eDisGo

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.