|
|
|
"""
|
|
|
|
|
|
|
|
"sqlite":{"class":{"read":disk.SQLiteReader,"write":disk.SQLiteWriter}},
|
|
|
|
_fhost = _host
|
|
|
|
# Let us update the parameters we have thus far
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
|
|
uri = ''.join([_provider,"://",_account,_fhost,'/',_database])
|
|
|
|
|
|
|
|
_engine = sqlalchemy.create_engine (uri,future=True)
|
|
|
|
_out = {'sqlalchemy':_engine}
|
|
|
|
_pargs = {'host':_host,'port':_port,'username':_username,'password':_password}
|
|
|
|
for key in _pargs :
|
|
|
|
if _pargs[key] != '' :
|
|
|
|
_out[key] = _pargs[key]
|
|
|
|
return _out
|
|
|
|
def _getClassInstance(_group,**_args):
|
|
|
|
"""
|
|
|
|
This function returns the class instance we are attempting to instanciate
|
|
|
|
:_group items in providers.CATEGORIES.keys()
|
|
|
|
:_args arguments passed to the factory class
|
|
|
|
"""
|
|
|
|
if 'read' in _args or 'write' in _args :
|
|
|
|
_context = 'read' if 'read' in _args else _args['write']
|
|
|
|
_info = _args[_context]
|
|
|
|
else:
|
|
|
|
_context = _args['context'] if 'context' in _args else 'read'
|
|
|
|
_class = providers.READ[_group] if _context == 'read' else providers.WRITE[_group]
|
|
|
|
if type(_class) == dict and _args['provider'] in _class:
|
|
|
|
_class = _class[_args['provider']]
|
|
|
|
|
|
|
|
return _class
|
|
|
|
|
|
|
|
def __instance(**_args):
|
|
|
|
"""
|
|
|
|
#
|
|
|
|
|