From d8e004e9bdbac145cf4a80e13281deecc8bb1454 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 24 Jun 2025 12:12:21 +0200 Subject: [PATCH] update --- sqlite/read_config.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 sqlite/read_config.py diff --git a/sqlite/read_config.py b/sqlite/read_config.py new file mode 100644 index 0000000..493d9d4 --- /dev/null +++ b/sqlite/read_config.py @@ -0,0 +1,34 @@ +''' + ____ ___ _ _ _ + / ___| / _ \| | (_) |_ ___ + \___ \| | | | | | | __/ _ \ + ___) | |_| | |___| | || __/ + |____/ \__\_\_____|_|\__\___| + +Script to read data from a sqlite database +/usr/bin/python3 /var/www/moduleair_pro_4g/sqlite/read_config.py + +''' + +import sqlite3 +import sys + +# Connect to the SQLite database +conn = sqlite3.connect("/var/www/moduleair_pro_4g/sqlite/sensors.db") +cursor = conn.cursor() + + +query = f"SELECT * FROM config_table" +cursor.execute(query) + + +rows = cursor.fetchall() +rows.reverse() # Reverse the order in Python (to get ascending order) + + +# Display the results +for row in rows: + print(row) + +# Close the database connection +conn.close()