Guest User

Untitled

a guest
Jul 25th, 2016
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. import shutil
  2. import os
  3. import pyorient
  4.  
  5. client = pyorient.OrientDB("localhost", 2424)
  6. user = "root"
  7. password = "password"
  8. session_id = client.connect(user, password)
  9.  
  10.  
  11. def dropdbs():
  12. i = 0
  13. names = [n for n in client.db_list().oRecordData['databases'].keys()]
  14. for nm in names:
  15. try:
  16. client.db_drop(nm)
  17. i += 1
  18. except:
  19. continue
  20. return i
  21.  
  22.  
  23. def drop():
  24. try:
  25. shutil.rmtree(os.path.join(os.path.expanduser("~"), ".sovrin", "data"))
  26. except Exception as e:
  27. print("directory not found {}".format(e))
  28. return dropdbs()
  29.  
  30.  
  31. drop()
Add Comment
Please, Sign In to add comment