Skip to main content

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

See the documentation for more information!

Installation

pip install oemof.db

You can also install the in-development version with:

pip install https://github.com/oemof/oemof.db/archive/master.zip

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

pip install -e git://github.com/oemof/oemof.db.git@master#egg=oemof.db

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 git@github.com:oemof/oemof.db.git

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
cfg.load_config(config_file=<you-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:

[postGIS]
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.

Development

To run the all tests run:

tox

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

Windows

set PYTEST_ADDOPTS=--cov-append
tox

Other

PYTEST_ADDOPTS=--cov-append tox

v0.0.6 (2019-12-03)

Testing

  • Testing is now done via pytest``_ instead of ``nose.

Bug fixes

  • This release should finally get rid of issue #28.

Other changes

  • Switched to a src based repository layout. This is done via a special packaging template helping with a lot of stuff. Most importantly it helps with correct test isolation so that issue #28 can properly be tested against.

Contributors

  • Stephan Günther

v0.0.3 (March 10, 2016)

New features

  • It’s now possible to have multiple sections for different databases in config.ini (PR #7)

Documentation

  • The documentation was erroneously talking about feedinlib in places where it should have said oemof.db. (issue #3)

Contributors

  • Uwe Krien

  • Stephan Günther

  • Guido Pleßmann

v0.0.4 (December 16, 2016)

New features

  • Create an empty database table with primary key type serial in tools.py

  • Access grant to users/ group of users, see grant_db_access in tools.py

  • Additional optional keyword argument to specify config file (issue #21)

  • Ask for password and save store in keyring if not existent (issue #22)

Documentation

Testing

Bug fixes

  • Add missing keyrings.alt dependency

Other changes

Contributors

  • Guido Pleßmann

  • Uwe Krien

v0.0.2 (January 29, 2016)

Other changes

  • Package is now called oemof.db

Contributors

  • Uwe Krien

  • Stephan Günther

v0.0.1 (October 30, 2015)

New features

Documentation

Testing

Bug fixes

Other changes

Contributors

  • Uwe Krien

v0.0.5 (March 20th, 2017)

Bug fixes

  • In order to play well with oemof, oemof/db/__init__.py has been removed. This should fix oemof’s issue #269.

Contributors

  • Stephan Günther

Metadata

Release files for oemof.db 0.0.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for oemof.db 0.0.6
File Size Uploaded
oemof.db-0.0.6.tar.gz 30.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for oemof.db 0.0.6
File Interpreter ABI Platform
oemof.db-0.0.6-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 50.3 kB

Release files / oemof.db-0.0.6.tar.gz

Download URL oemof.db-0.0.6.tar.gz
Size 30.2 kB
Tags Source
SHA-256 checksum
How to use checksums
cfa4629a1165377fbad50c1b8019ae8243136170cb065098ef862d42fcb608cb
BLAKE2b-256 checksum
How to use checksums
8fee0c7c04e7d1549a08b7b7aea70c2e62f468930599820488316b4676351258
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.40.0 CPython/3.6.8

Release files / oemof.db-0.0.6-py2.py3-none-any.whl

Download URL oemof.db-0.0.6-py2.py3-none-any.whl
Size 20.1 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
34edb306cb727f6f4fa64011150a1ae090e75446ea2e5f9268840d71b5e20bee
BLAKE2b-256 checksum
How to use checksums
e7618ad7d36c8a6bf0c0a42c99d873053e925ca68f27d5e2e107487752f87c8c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.40.0 CPython/3.6.8

Release history Release notifications | RSS feed

This release

0.0.6 This release

2 release files

0.0.5

1 release file

0.0.4

2 release files

0.0.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page