From da5cba12209761b84094dac593d8abc295c76465 Mon Sep 17 00:00:00 2001 From: Jonny Ervine Date: Wed, 17 Jun 2015 12:37:04 +0800 Subject: [PATCH] Delete updateMysql.py --- updateMysql.py | 23 ----------------------- 1 file changed, 23 deletions(-) delete mode 100644 updateMysql.py diff --git a/updateMysql.py b/updateMysql.py deleted file mode 100644 index 6fc7d98..0000000 --- a/updateMysql.py +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/python -## -## Script to import the temperature and humidity into a MySQL database -## -import sys -import MySQLdb -#import datetime -#import time - -def main(temp, humid, host, db, user, passwd): - print('Temp = {0} *C, Hum = {1} %'.format(temp, humid)) - print('Updating MySQL database next ...') - connection = MySQLdb.connect(host,user,passwd,db) - cursor=connection.cursor() - sqltemp=format(temp, '5.1f') - sqlhumid=format(humid, '5.1f') - print(sqltemp, sqlhumid) - sql = """INSERT INTO TempHumid (ComputerTime, Temperature, Humidity, id) VALUES (unix_timestamp(now()), %s, %s, NULL)""" - args = (sqltemp, sqlhumid) - cursor.execute(sql, args) - connection.commit() - cursor.close() - return 0