def __init__(self, name, config={}): try: self._config = dict_merge(Connection._CONFIG['db'][name], config) except KeyError: raise ConnectionException('Connection name, {0}, not defined in configuration'.format(name)) self._config['database'] = name self.url = url.URL(**self._config) self.engine = create_engine(self.url, convert_unicode=True, pool_recycle=14400) # 4-hour recycle
def __init__(self, name, config={}): try: self._config = dict_merge(Connection._CONFIG['db'][name], config) except KeyError: raise ConnectionException( 'Connection name, {0}, not defined in configuration'.format( name)) self._config['database'] = name self.url = url.URL(**self._config) self.engine = create_engine(self.url, convert_unicode=True, pool_recycle=14400) # 4-hour recycle
def merge(self, override=None): self.update(dict_merge(self, override))