Files
OSIT-AE-API-FastAPI/tests/integration/test_int_db_connectivity.py
Scott Idem b2384f2869 Tests: Reorganize test suite into functional subdirectories
- Categorized scripts into tests/unit/, tests/integration/, tests/e2e/, and tests/tools/.
- Adopted consistent naming prefixes (test_unit_*, test_int_*, test_e2e_*, tool_*).
- Renamed conftest_mock.py to mock_config_helper.py for clarity.
- Updated test_int_boot_diagnosis.py with sys.path setup for root-level execution.
2026-01-16 10:46:19 -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()