SHARE
TWEET

Untitled

a guest Mar 19th, 2019 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import json
  2. import time
  3. import datetime
  4. import pymongo
  5. from pymongo import MongoClient
  6.  
  7.  
  8. t = time.localtime()
  9. timestamp = time.strftime('%b-%d-%Y', t)
  10. dict_log = "dict_" + timestamp
  11. adc_log = "adc_" + timestamp
  12. rgb_log = "rgb_" + timestamp
  13. acc_log = "acc_" + timestamp
  14. hot_log = "hot_" + timestamp
  15.  
  16. client = pymongo.MongoClient("mongodb+srv://Ryan:Fablab1@biofinder-rgsud.gcp.mongodb.net/admin")
  17.  
  18. db = client['BioFinder']
  19. dict_data = db['Test']
  20. adc_data = db['ADC']
  21. rgb_data = db['RGB']
  22. acc_data = db['ACC']
  23. hot_data = db['HOT']
  24. print "Uploading data..."
  25.  
  26. with open('%s.json' % dict_log) as f:
  27.         file_data = json.load(f)
  28.         dict_data.insert(file_data)
  29.  
  30. with open('%s.json' % adc_log) as f:
  31.         file_data = json.load(f)
  32.         adc_data.insert(file_data)
  33.  
  34. with open('%s.json' % rgb_log) as f:
  35.         file_data = json.load(f)
  36.         rgb_data.insert(file_data)
  37.  
  38. with open('%s.json' % acc_log) as f:
  39.         file_data = json.load(f)
  40.         acc_data.insert(file_data)
  41.  
  42. with open('%s.json' % hot_log) as f:
  43.         file_data = json.load(f)
  44.         hot_data.insert(file_data)
  45. print "Finished"
  46. client.close()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top