oemof.db
latest
  • Getting started
    • Overview
  • oemof
    • oemof package
  • oemof package
    • Subpackages
    • Module contents
  • oemof.db package
    • Submodules
    • oemof.db.coastdat module
    • oemof.db.config module
    • oemof.db.feedin_pg module
    • oemof.db.powerplants module
    • oemof.db.test_config_changes module
    • oemof.db.tools module
    • Module contents
  • Contributing
    • Bug reports
    • Documentation improvements
    • Feature requests and feedback
    • Development
  • Authors
  • What’s New
    • v0.0.6 (2019-12-03)
    • v0.0.5 (March 20th, 2017)
    • v0.0.4 (December 16, 2016)
    • v0.0.3 (March 10, 2016)
    • v0.0.2 (January 29, 2016)
    • v0.0.1 (October 30, 2015)
oemof.db
  • Docs »
  • oemof.db 0.0.6 documentation
  • Edit on GitHub

Welcome to oemof’s database related documentation!¶

Contents:¶

Getting started¶

Overview¶

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!

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

oemof¶

oemof package¶

Subpackages¶
oemof.db package¶
Submodules¶
oemof.db.coastdat module¶
oemof.db.config module¶
oemof.db.feedin_pg module¶
oemof.db.powerplants module¶
oemof.db.test_config_changes module¶
oemof.db.tools module¶
Module contents¶
Module contents¶

Contributing¶

Contributions are welcome, and they are greatly appreciated! Every little bit helps, and credit will always be given.

Bug reports¶

When reporting a bug please include:

  • Your operating system name and version.
  • Any details about your local setup that might be helpful in troubleshooting.
  • Detailed steps to reproduce the bug.

Documentation improvements¶

oemof.db could always use more documentation, whether as part of the official oemof.db docs, in docstrings, or even on the web in blog posts, articles, and such.

Feature requests and feedback¶

The best way to send feedback is to file an issue at https://github.com/oemof/oemof.db/issues.

If you are proposing a feature:

  • Explain in detail how it would work.
  • Keep the scope as narrow as possible, to make it easier to implement.
  • Remember that this is a volunteer-driven project, and that code contributions are welcome :)

Development¶

To set up oemof.db for local development:

  1. Fork oemof.db (look for the “Fork” button).

  2. Clone your fork locally:

    git clone git@github.com:oemof/oemof.db.git
    
  3. Create a branch for local development:

    git checkout -b name-of-your-bugfix-or-feature
    

    Now you can make your changes locally.

  4. When you’re done making changes run all the checks and docs builder with tox one command:

    tox
    
  5. Commit your changes and push your branch to GitHub:

    git add .
    git commit -m "Your detailed description of your changes."
    git push origin name-of-your-bugfix-or-feature
    
  6. Submit a pull request through the GitHub website.

Pull Request Guidelines¶

If you need some code review or feedback while you’re developing the code just make the pull request.

For merging, you should:

  1. Include passing tests (run tox) [1].
  2. Update documentation when there’s new API, functionality etc.
  3. Add a note to CHANGELOG.rst about the changes.
  4. Add yourself to AUTHORS.rst.
[1]

If you don’t have all the necessary python versions available locally you can rely on Travis - it will run the tests for each change you add in the pull request.

It will be slower though …

Tips¶

To run a subset of tests:

tox -e envname -- pytest -k test_myfeature

To run all the test environments in parallel (you need to pip install detox):

detox

Authors¶

  • Guido Pleßmann
  • Stephan Günther
  • Uwe Krien

What’s New¶

These are new features and improvements of note in each release

Releases

  • v0.0.6 (2019-12-03)
  • v0.0.5 (March 20th, 2017)
  • v0.0.4 (December 16, 2016)
  • v0.0.3 (March 10, 2016)
  • v0.0.2 (January 29, 2016)
  • v0.0.1 (October 30, 2015)

v0.0.6 (2019-12-03)¶

Testing¶
  • Testing is now done via :code:`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.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

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.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.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

Indices and tables¶

  • Index
  • Module Index
  • Search Page

© Copyright 2015-2019, oemof developer group Revision 7cbf8990.

Built with Sphinx using a theme provided by Read the Docs.
Read the Docs v: latest
Versions
latest
stable
dev
Downloads
pdf
html
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.