mirror of
https://github.com/infinition/Bjorn.git
synced 2026-03-15 17:01:58 +00:00
Add Loki and Sentinel utility classes for web API endpoints
- Implemented LokiUtils class with GET and POST endpoints for managing scripts, jobs, and payloads. - Added SentinelUtils class with GET and POST endpoints for managing events, rules, devices, and notifications. - Both classes include error handling and JSON response formatting.
This commit is contained in:
35
debug_schema.py
Normal file
35
debug_schema.py
Normal file
@@ -0,0 +1,35 @@
|
||||
|
||||
import sqlite3
|
||||
import os
|
||||
|
||||
db_path = "bjorn.db"
|
||||
|
||||
def check_schema():
|
||||
if not os.path.exists(db_path):
|
||||
print(f"Database {db_path} not found.")
|
||||
return
|
||||
|
||||
conn = sqlite3.connect(db_path)
|
||||
cursor = conn.cursor()
|
||||
|
||||
tables = ["rl_training_log", "rl_experiences"]
|
||||
|
||||
with open("schema_debug.txt", "w") as f:
|
||||
for table in tables:
|
||||
f.write(f"\nSchema for {table}:\n")
|
||||
try:
|
||||
cursor.execute(f"PRAGMA table_info({table})")
|
||||
columns = cursor.fetchall()
|
||||
if not columns:
|
||||
f.write(" (Table not found)\n")
|
||||
else:
|
||||
for col in columns:
|
||||
f.write(f" - {col[1]} ({col[2]})\n")
|
||||
except Exception as e:
|
||||
f.write(f" Error: {e}\n")
|
||||
|
||||
conn.close()
|
||||
|
||||
if __name__ == "__main__":
|
||||
check_schema()
|
||||
print("Done writing to schema_debug.txt")
|
||||
Reference in New Issue
Block a user