Skip to content
Open Energy Modelling Framework - An extension to use the oemof related postgis database (requires database access on oemof-server)
Branch: dev
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.


Type Name Latest commit message Commit time
Failed to load latest commit information.



PyPI Package latest release Commits since latest release Supported versions PyPI - License

Travis-CI Build Status PyPI Wheel Supported implementations Documentation Status

Coverage Status Coverage Status Scrutinizer Status Codacy Code Quality Status CodeClimate Quality Status

Open Energy Modelling Framework - An extension for all database related things

See the documentation for more information!


pip install oemof.db

You can also install the in-development version with:

pip install

Unfortunately installing the PyPi package doesn't work until #28 is fixed. Instead, you have to install via:

pip install -e git://

Note that you have to have git installed for this to work.

If you want to have the developer version clone the repository by

git clone

and you can install it using pip3 with the -e flag.

sudo pip3 install -e <path/to/the/oemof.db/repository/root/directory>

Keep virtualenvs in mind!

Configuration and usage

As the purpose of this package is to facilitate usage of the oemof database, it needs to know how to connect to this database. Being part of oemof, as fallback oemof.db always looks for this configuration in the file config.ini in a directory called .oemof in your home directory.

A particular config-file can either specified and accessed via

from oemof.db import cfg

# only load config file

# access config parameters
cfg.get(<section>, <parameter>)

If you're interested in establishing a database connection and specify config file connection parameters are stored in use

from oemof.db import cfg

# establish database connection with specified section and config_file
db.connection(section=<section>, config_file=<you-config-file>)

To configure database access this file has to have at least one dedicated section containing the necessary options, like this:

username = username under which to connect to the database
database = name of the database from which to read
host     = host to connect to
port     = port to connect to
pw       = password used to connect with the given username (OPTIONAL)

The section is assumed to be named postGIS by default, but you can name it differently and have multiple sections for different databases if the need arises.

The password is optional. If you don't want to store the password in the config.ini, you may store it using the keyring package, which is a dependency of oemof.db, like this:

>>> import keyring
>>> keyring.set_password("database", "username")

where "database" and "username" have the same values as the corresponding options in config.ini.


To run the all tests run:


Note, to combine the coverage data from all the tox environments run:

set PYTEST_ADDOPTS=--cov-append
PYTEST_ADDOPTS=--cov-append tox
You can’t perform that action at this time.