Advertisement
Guest User

Untitled

a guest
Sep 26th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. {'interval': 300, 'size': 5}
  2. None
  3.  
  4. settings = {}
  5. conn = mariadb.connect(host=db_host, user=db_user, password=db_password, database="my_db")
  6. cursor = conn.cursor()
  7. try:
  8. cursor.execute("SELECT name, value FROM settings")
  9. results = cursor.fetchall()
  10. except mariadb.Error as error:
  11. logger.sendLog("ERROR RETRIEVING GLOBAL SETTINGS FOR ({})".format(environment))
  12.  
  13. conn.close()
  14.  
  15. for name, value in results:
  16. settings[name] = value
  17.  
  18. print(settings)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement