Spaces:
Paused

File size: 1,159 Bytes
060fdc1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37

import asyncio
import os
import sys

# Ensure local imports work
sys.path.append(os.getcwd())

from core.database import async_session_factory
from sqlalchemy import select
from models.ticket import Ticket
from models.nexus_memory import NexusMemory

async def test_mapper_init():
    print("Testing SQLAlchemy Mapper Initialization...")
    async with async_session_factory() as db:
        try:
            # This will trigger mapper initialization
            stmt = select(Ticket).limit(1)
            await db.execute(stmt)
            print("OK: Ticket mapper initialized successfully.")
            
            stmt2 = select(NexusMemory).limit(1)
            await db.execute(stmt2)
            print("OK: NexusMemory mapper initialized successfully.")
            
            print("SUCCESS: ALL MAPPERS INITIALIZED SUCCESSFULLY.")
        except Exception as e:
            print(f"FAIL: Mapper Initialization FAILED!")
            print(f"Error Type: {type(e).__name__}")
            print(f"Error Message: {str(e)}")
            import traceback
            traceback.print_exc()

if __name__ == "__main__":
    asyncio.run(test_mapper_init())