Skip to content

Commit

Permalink
Implement IXMP4Backend.get_scenarios()
Browse files Browse the repository at this point in the history
  • Loading branch information
khaeru committed Jan 30, 2024
1 parent ad84ac2 commit 5b08fbd
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion ixmp/backend/ixmp4.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ def __init__(self):

# Add an ixmp4.Platform using ixmp4's own configuration code
# TODO Move this to a test fixture
# NB ixmp.tests.conftest.test_sqlite_mp exists, but is not importable (missing
# __init__.py)
import ixmp4.conf

dsn = "sqlite:///:memory:"
Expand All @@ -30,6 +32,15 @@ def __init__(self):
# Instantiate and store
self._platform = ixmp4.Platform(name)

def get_scenarios(self, default, model, scenario):
# Current fails with:
# sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) no such table: run
# [SQL: SELECT DISTINCT run.model__id, run.scenario__id, run.version,
# run.is_default, run.id
# FROM run
# WHERE run.is_default = 1 ORDER BY run.id ASC]
return self._platform.runs.list()

# The below methods of base.Backend are not yet implemented
def _ni(self, *args, **kwargs):
raise NotImplementedError
Expand All @@ -55,7 +66,6 @@ def _ni(self, *args, **kwargs):
get_meta = _ni
get_model_names = _ni
get_nodes = _ni
get_scenarios = _ni
get_scenario_names = _ni
get_timeslices = _ni
get_units = _ni
Expand Down

0 comments on commit 5b08fbd

Please sign in to comment.