import sqlalchemy from sqlalchemy import text import json # Connection details from .env DB_USER = "aether_dev" DB_PASS = "$1sky.AE_dev.2023" DB_SERVER = "vpn-db.oneskyit.com" DB_PORT = "3306" DB_NAME = "aether_dev" # Construct URI DB_URI = f"mysql://{DB_USER}:{DB_PASS}@{DB_SERVER}:{DB_PORT}/{DB_NAME}" def test_raw_describe(): engine = sqlalchemy.create_engine(DB_URI) print(f"Connecting to {DB_SERVER}...") try: with engine.connect() as conn: result = conn.execute(text("DESCRIBE journal")) columns = [] for row in result.fetchall(): columns.append({ "Field": row[0], "Type": row[1], "Null": row[2], "Default": row[4] }) # Print as a nice JSON snippet print("\n--- Raw DB Metadata for 'journal' (Sample) ---") print(json.dumps(columns[:5], indent=2)) # Highlight the specific fields mentioned in the task print("\n--- Target Fields ---") targets = ["name", "enable", "passcode_timeout", "created_on"] for col in columns: if col["Field"] in targets: print(f"Field: {col['Field']:16} | Type: {col['Type']:15} | Null: {col['Null']:3} | Default: {col['Default']}") except Exception as e: print(f"Error: {e}") if __name__ == "__main__": test_raw_describe()