import sys sys.path.append('.') import asyncio if sys.platform == 'win32': asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) from core.database import async_session_factory from models.user import User from models.user_workspace import UserWorkspace from sqlalchemy import select async def main(): async with async_session_factory() as db: stmt = select(User.full_name, User.global_role, UserWorkspace.workspace_id, UserWorkspace.role).outerjoin(UserWorkspace, User.id == UserWorkspace.user_id) result = await db.execute(stmt) for row in result.all(): print(row) if __name__ == "__main__": asyncio.run(main())