Files
OSIT-AE-API-FastAPI/tests/standalone_db_test.py
Scott Idem 31fd384704 Docs: Consolidate admin documentation and migrate reference data
- Created LOCAL_DEVELOPMENT_GUIDE.md and DEPLOYMENT_GUIDE_MANUAL.md from legacy txt files.
- Migrated country/time_zone data and requirements.txt to documentation/reference_data/.
- Removed redundant admin/documentation/ and admin/data_files/ directories.
- Enhanced app/lib_schema_v3.py to explicitly capture 'required' fields from DB 'NOT NULL' constraint.
- Added verification tests for schema logic and standalone DB connectivity.
2026-01-16 10:06:51 -05:00

47 lines
1.5 KiB
Python

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