Anpassungen für mysql Datenbankfelder
authorChrisu Jähnl <chrisu@skorzak.priv.at>
Thu, 10 May 2018 21:12:56 +0000 (21:12 +0000)
committerChrisu Jähnl <chrisu@skorzak.priv.at>
Thu, 10 May 2018 21:12:56 +0000 (21:12 +0000)
seewasser.py

index a65d8c7..40d2455 100755 (executable)
@@ -68,9 +68,9 @@ def writesensordatadb(config, sensor_id, sensor_name, timestamp, value_type, val
     host = config.get('database','hostname')
     db = config.get('database','database')
     
-    engine = create_engine('mysql+mysqldb://{}:{}@{}/{}'.format(user, pwd, host, db), echo=True)
+    engine = create_engine('mysql+mysqldb://{}:{}@{}/{}'.format(user, pwd, host, db), echo=False)
     conn = engine.connect()
-    conn.execute("insert into sensors (sensor_id, sensor_name, value_type, value_raw, value, timestamp) values (?,?,?,?,?,?)", sensor_id, sensor_name, value_type, value_raw, value, timestamp)
+    conn.execute("insert into sensors (sensor_id, sensor_name, value_type, value_raw, value, timestamp) values (%s,%s,%s,%s,%s,%s)", sensor_id, sensor_name, value_type, value_raw, value, timestamp)
     conn.close()