import sqlalchemy as sa from common.db import Session async def is_match(holder_name: str) -> dict | None: """Case-insensitive exact match against sanctions_entries.normalized_name.""" async with Session() as session: result = await session.execute( sa.text( "SELECT country, list_source FROM sanctions_entries " "WHERE lower(normalized_name) = lower(:name) LIMIT 1" ), {"name": holder_name}, ) row = result.first() if row is None: return None return {"country": row.country, "list_source": row.list_source}