Data Layer (ixmp4.data)
The ixmp4.data module organizes each datatype into a few files for consistency:
db.py: sqlalchemy database models and other database definitions
dto.py: a data transfer class for item serialization
exceptions.py: exceptions specific to the datatype (NotFound, NotUnique, etc.)
filter.py: filter definitions for use in repositories
repositories.py: repository classes responsible for interacting with the database
service.py: service class as the main interface for the datatype which combines all of the above
The service classes are instantiated together via a ixmp4.data.backend.Backend object
which can be used by other code to perform operations in the database or on a remote ixmp4
http server. This construct and its classes can be referred to as the “data layer”.
Backend
- class ixmp4.data.backend.IamcSubobject
Bases:
objectNamespace grouping all IAMC-related data services on a
Backend.- datapoints: DataPointService
- timeseries: TimeSeriesService
- variables: VariableService
- regions: IamcRegionService
- units: IamcUnitService
- models: IamcModelService
- scenarios: IamcScenarioService
- class ixmp4.data.backend.OptimizationSubobject
Bases:
objectNamespace grouping all optimization-related data services on a
Backend.- equations: EquationService
- indexsets: IndexSetService
- parameters: ParameterService
- scalars: ScalarService
- tables: TableService
- variables: VariableService
- class ixmp4.data.backend.Backend(transport: Transport)
Bases:
objectCentral data-layer object that aggregates all service instances.
A
Backendis built around a singleTransportand exposes every data service as an attribute. IAMC-related services are grouped underiamcand optimisation-related services underoptimization.- optimization: OptimizationSubobject
Namespace for optimisation services (equations, indexsets, parameters, …).
- iamc: IamcSubobject
Namespace for IAMC data services (datapoints, timeseries, variables, …).
- meta: RunMetaEntryService
- models: ModelService
- regions: RegionService
- runs: RunService
- scenarios: ScenarioService
- units: UnitService
- checkpoints: CheckpointService