This commit is contained in:
root
2025-06-24 12:12:21 +02:00
parent 675482929e
commit d8e004e9bd

34
sqlite/read_config.py Normal file
View File

@@ -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()