You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
"""
|
|
|
|
Data Transport - 1.0
|
|
|
|
Steve L. Nyemba, The Phi Technology LLC
|
|
|
|
|
|
|
|
This module is designed to serve as a wrapper to a set of supported data stores :
|
|
|
|
- couchdb
|
|
|
|
- mongodb
|
|
|
|
- Files (character delimited)
|
|
|
|
- Queues (RabbmitMq)
|
|
|
|
- Session (Flask)
|
|
|
|
- s3
|
|
|
|
The supported operations are read/write and providing meta data to the calling code
|
|
|
|
Requirements :
|
|
|
|
pymongo
|
|
|
|
boto
|
|
|
|
couldant
|
|
|
|
The configuration for the data-store is as follows :
|
|
|
|
couchdb:
|
|
|
|
{
|
|
|
|
args:{
|
|
|
|
url:<url>,
|
|
|
|
username:<username>,
|
|
|
|
password:<password>,
|
|
|
|
dbname:<database>,
|
|
|
|
except Exception as e:
|
|
|
|
# for row in sample:
|
|
|
|
# """
|
|
|
|
# def archive(self):
|
|
|
|
# pass
|
|
|
|
# def flush(self):
|
|
|
|
# pass
|
|
|
|
|
|
|
|
# class factory :
|
|
|
|
# @staticmethod
|
|
|
|
# def instance(**args):
|
|
|
|
|
|
|
|
# source = args['type']
|
|
|
|
# params = args['args']
|
|
|
|
# anObject = None
|
|
|
|
|
|
|
|
# if source in ['HttpRequestReader','HttpSessionWriter']:
|
|
|
|
# #
|
|
|
|
# # @TODO: Make sure objects are serializable, be smart about them !!
|
|
|
|
# #
|
|
|
|
# aClassName = ''.join([source,'(**params)'])
|
|
|
|
|
|
|
|
|
|
|
|
# else:
|
|
|
|
|
|
|
|
# stream = json.dumps(params)
|
|
|
|
# aClassName = ''.join([source,'(**',stream,')'])
|
|
|
|
# try:
|
|
|
|
# anObject = eval( aClassName)
|
|
|
|
# #setattr(anObject,'name',source)
|
|
|
|
# except Exception,e:
|
|
|
|
# print ['Error ',e]
|