Package: oemof.db
Open Energy Modelling Framework - An extension for all database related thingsSeethe documentationfor more information!Installationpip install oemof.dbYou can also install the in-development version with:pip install https://github.com/oemof/oemof.db/archive/master.zipUnfortunately installing the PyPi package doesn’t work until #28 is fixed.
Instead, you have to install via:pipinstall-egit://github.com/oemof/oemof.db.git@master#egg=oemof.dbNote that you have to havegitinstalled for this to work.If you want to have the developer version clone the repository bygitclonegit@github.com:oemof/oemof.db.gitand you can install it using pip3 with the -e flag.sudopip3install-e<path/to/the/oemof.db/repository/root/directory>Keepvirtualenvsin mind!Configuration and usageAs the purpose of this package is to facilitate usage of theoemofdatabase, it needs to know how to connect to this database. Being part ofoemof, as fallbackoemof.dbalways looks for this configuration in the
fileconfig.iniin a directory called.oemofin your home directory.A particular config-file can either specified and accessed viafromoemof.dbimportcfg# only load config filecfg.load_config(config_file=<you-config-file>)# access config parameterscfg.get(<section>,<parameter>)If you’re interested in establishing a database connection and specify config
file connection parameters are stored in usefromoemof.dbimportcfg# establish database connection with specified section and config_filedb.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 databasedatabase=name of the database from which to readhost=host to connect toport=port to connect topw=password used to connect with the given username (OPTIONAL)The section is assumed to be namedpostGISby 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 theconfig.ini, you may store it using thekeyring package, which is a
dependency ofoemof.db, like this:>>>importkeyring>>>keyring.set_password("database","username")where"database"and"username"have the same values as the
corresponding options inconfig.ini.DevelopmentTo run the all tests run:toxNote, to combine the coverage data from all the tox environments run:Windowsset PYTEST_ADDOPTS=--cov-append
toxOtherPYTEST_ADDOPTS=--cov-append toxv0.0.6 (2019-12-03)TestingTesting is now done viapytest``_instead of ``nose.Bug fixesThis release should finally get rid ofissue #28.Other changesSwitched to asrcbased repository layout. This is done via a
specialpackaging templatehelping with a lot of stuff. Most
importantly it helps with correct test isolation so thatissue
#28can properly be tested against.ContributorsStephan Güntherv0.0.3 (March 10, 2016)New featuresIt’s now possible to have multiple sections for different databases inconfig.ini(PR #7)DocumentationThe documentation was erroneously talking aboutfeedinlibin places
where it should have saidoemof.db.
(issue #3)ContributorsUwe KrienStephan GüntherGuido Pleßmannv0.0.4 (December 16, 2016)New featuresCreate an empty database table with primary key type serial intools.pyAccess grant to users/ group of users, seegrant_db_accessintools.pyAdditional optional keyword argument to specify config file (issue #21)Ask for password and save store in keyring if not existent (issue #22)DocumentationTestingBug fixesAdd missing keyrings.alt dependencyOther changesContributorsGuido PleßmannUwe Krienv0.0.2 (January 29, 2016)Other changesPackage is now calledoemof.dbContributorsUwe KrienStephan Güntherv0.0.1 (October 30, 2015)New featuresDocumentationTestingBug fixesOther changesContributorsUwe Krienv0.0.5 (March 20th, 2017)Bug fixesIn order to play well withoemof,oemof/db/__init__.pyhas been
removed. This should fixoemof’sissue #269.ContributorsStephan Günther