import asyncio from app.core.database import AsyncSessionLocal from app.models.user import User from app.models.tenant import Tenant from sqlalchemy import select async def check(): async with AsyncSessionLocal() as db: result = await db.execute( select(User, Tenant).join(Tenant).where(User.email == 'javier@ventas.com') ) user, tenant = result.one() print(f"user.tenant_id: {user.tenant_id}") print(f"tenant.id: {tenant.id}") print(f"tenant.slug: {tenant.slug}") print(f"user.role: {user.role}") print(f"role.is_client: {user.role.is_client}") asyncio.run(check())