From bf226e93d7d6474912466ced8bda8a61ff168519 Mon Sep 17 00:00:00 2001 From: mohammedcifci <118259207+6028570@users.noreply.github.com> Date: Tue, 27 Feb 2024 10:49:58 +0100 Subject: [PATCH] Revert "Mohammed" --- goodGarden.sql | 13 ++++++------- index.py | 4 +--- updatedata.sql | 2 -- 3 files changed, 7 insertions(+), 12 deletions(-) delete mode 100644 updatedata.sql diff --git a/goodGarden.sql b/goodGarden.sql index dd71584..de6d9d1 100644 --- a/goodGarden.sql +++ b/goodGarden.sql @@ -1,17 +1,16 @@ -CREATE DATABASE IF NOT EXISTS goodgarden; -USE goodgarden; +DROP DATABASE IF EXISTS goodgarden; +CREATE DATABASE goodgarden; -CREATE TABLE IF NOT EXISTS goodgarden.sensor_data ( +CREATE TABLE goodgarden.sensor_data ( id INT UNSIGNED NOT NULL AUTO_INCREMENT, timestamp INT, gateway_receive_time VARCHAR(50), device INT, - value DECIMAL(12, 8), -- Aangepaste precisie naar DECIMAL(12, 8) + value DECIMAL(10, 5), PRIMARY KEY (id) ); Invoegen van gegevens in de 'sensor_data'-tabel INSERT INTO goodgarden.sensor_data (timestamp, gateway_receive_time, device, value) -VALUES - (1707295162, '2024-02-07T08:39:22Z', 256, 4.107448101043701), - (1707261284, '2024-02-06T23:14:44Z', 322, 4.111111164093018); +VALUES (1707295162, '2024-02-07T08:39:22Z', 256, 4.107448101043701), + (1707261284, '2024-02-06T23:14:44Z', 322, 4.111111164093018); diff --git a/index.py b/index.py index af94f78..0bc2059 100644 --- a/index.py +++ b/index.py @@ -2,8 +2,6 @@ import mysql.connector import requests import time - - def database_connect(): return mysql.connector.connect( host="localhost", @@ -66,4 +64,4 @@ def load_data(data): print("Data ingevoegd in de database.") if __name__ == "__main__": - fetch_data() + fetch_data() \ No newline at end of file diff --git a/updatedata.sql b/updatedata.sql deleted file mode 100644 index 21cc3cd..0000000 --- a/updatedata.sql +++ /dev/null @@ -1,2 +0,0 @@ -USE goodgarden; -ALTER TABLE goodgarden.sensor_data MODIFY COLUMN value DECIMAL(12, 2);