Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions dataprocessing/eGo_data_processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import time
import os
import codecs
from tools import io
from dataprocessing.tools import io

def data_processing():
# Configure logging
Expand Down Expand Up @@ -120,7 +120,7 @@ def data_processing():
]

# get database connection
conn = io.oedb_session(section='oedb')
conn = io.oedb_session(section='oep')

# iterate over list of sql- and python-snippets and execute them
for snippet in snippets:
Expand Down
2 changes: 1 addition & 1 deletion dataprocessing/eGo_preprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def preprocessing():
snippets = ['ego_pre_slp_parameters.sql']

# get database connection
conn = io.oedb_session(section='oedb')
conn = io.oedb_session(section='oep')

# iterate over list of sql- and python-snippets and execute them
for snippet in snippets:
Expand Down
2 changes: 1 addition & 1 deletion dataprocessing/python_scripts/ego_dp_loadarea_peakload.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def add_sectoral_peak_load(load_areas, **kwargs):
holidays = dict(cal.holidays(2011))

# get database connection object
conn = io.oedb_session(section='oedb')
conn = io.oedb_session(section='oep')
Session = sessionmaker(bind=conn)
session = Session()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def demand_per_mv_grid_district():
# retrieve sectoral demand from oedb

# get database connection
conn = io.oedb_session(section='oedb')
conn = io.oedb_session(section='oep')
Session = sessionmaker(bind=conn)
session = Session()

Expand Down
10 changes: 5 additions & 5 deletions dataprocessing/tools/io.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
from sqlalchemy import create_engine
from egoio.tools.db import connection
import getpass
import sys

def oedb_session(section='oedb'):
def oedb_session(section='oep'):
"""Get SQLAlchemy session object with valid connection to OEDB"""

# get session object by oemof.db tools (requires .oemof/config.ini
# get session object by oemof.db tools (requires ~/.egoio/config.ini
try:
from oemof import db
conn = db.connection(section=section)
conn = connection(section=section)

except:
print('Please provide connection parameters to database:\n' +
'Hit [Enter] to take defaults')

host = input('host (default 141.44.24.88): ') or 'oe.iws.cs.ovgu.de'
port = input('port (default 5432): ') or '5432'
database = input("database name (default 'oedb'): ") or 'oedb'
database = input("database name (default 'oep'): ") or 'oep'
user = input('user (default postgres): ')
# password = input('password: ')
password = getpass.getpass(prompt='password: ',
Expand Down