-
-
Save ryandotclair/48bcab655a5f2dd33ee1 to your computer and use it in GitHub Desktop.
db write out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Grab Total MB Sent for a given SG and write out the data to the database. | |
for item in result: | |
srdfa_total += item['SRDFA_MBSent'] | |
try: | |
print("Writing to the the database: {0}, {1}, {2}, {3}".format( | |
timestamp, symmetrix_id, storage_group_id, srdfa_total)) | |
cursor = db_connection.cursor() | |
SQL = "INSERT INTO reporterschema.main (date, sn, sg, srdfa_mbsent) VALUES (%s,%s,%s,%s)" | |
DATA = (timestamp, symmetrix_id, storage_group_id, srdfa_total) | |
cursor.execute(SQL, DATA) | |
cursor.close() | |
except Exception as e: | |
logger.critical("Table doesn't exist or is improperly configured!\n{0}".format(e)) | |
sys.exit(1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment