예제 #1
0
파일: run.py 프로젝트: Tiru-hcl/Py_MDB_Csv
 def store_records(self):
     '''
     method to store each record into mongodb
     :return:
     '''
     json_data = File_Handle.read_json()
     csv_rec = File_Handle.Csv_read(json_data['path'])
     try:
         for each_record in csv_rec:
             if each_record not in self.db_config.find(
                     json_data['order_ID']):
                 MongoDB.insert_record(each_record)
     except Exception as e:
         return e
     else:
         return 'records inserted successfully'
예제 #2
0
파일: run.py 프로젝트: Tiru-hcl/Py_MDB_Csv
 def record_deletion(self):
     '''
     data op method to delete records
     '''
     try:
         deleted_records = MongoDB.delete_rec(self.db_config)
     except Exception as e:
         return e
     else:
         return deleted_records
예제 #3
0
파일: run.py 프로젝트: Tiru-hcl/Py_MDB_Csv
 def get_records(self):
     '''
     dta op method to record count
     '''
     try:
         record_count = MongoDB.db_config().find().count()
     except Exception as e:
         return e
     else:
         return record_count
예제 #4
0
파일: run.py 프로젝트: Tiru-hcl/Py_MDB_Csv
 def sorting_records(self):
     '''
     method to sort record
     '''
     json_data = File_Handle.read_json()
     try:
         sorting_ascending_order = MongoDB.sort(self.db_config,
                                                json_data['field'])
     except Exception as e:
         return e
     else:
         return sorting_ascending_order
예제 #5
0
파일: run.py 프로젝트: Tiru-hcl/Py_MDB_Csv
 def updating_records(self):
     '''
     data operation method to update records
     '''
     json_data = File_Handle.read_json()
     try:
         update_result = MongoDB.update_records(self.db_config,
                                                json_data['query'],
                                                json_data['value'])
     except Exception as e:
         return e
     else:
         return update_result
예제 #6
0
def MongoDBRecovery(dbpath):
    return MongoDB(settings.MONGOD_PORT, 'mongod.recovery', dbpath)
예제 #7
0
 def get_command(self):
     return MongoDB.get_command(self) + ['--master']
예제 #8
0
 def __init__(self, dbpath):
     MongoDB.__init__(self, settings.MONGOD_REPLICATION_PORT,
                      'mongod.replication', dbpath)
예제 #9
0
파일: run.py 프로젝트: Tiru-hcl/Py_MDB_Csv
 def __init__(self):
     self.db_config = MongoDB.db_config()
예제 #10
0
 def get_command(self):
     return MongoDB.get_command(self) + ["--master"]
예제 #11
0
 def __init__(self, dbpath):
     MongoDB.__init__(self, settings.MONGOD_REPLICATION_PORT, "mongod.replication", dbpath)