from collections.abc import Sequence import sqlalchemy as sa from dmp.adapters.db import ReportingRepository from dmp.rosters.models import ArtistRosterLocalRep class ArtistRosterLocalRepRepository(ReportingRepository[ArtistRosterLocalRep]): def find_by_account_and_global_participant_ids( self, vendor_id: int, subaccount_id: int, global_participant_ids: list[str] ) -> Sequence[ArtistRosterLocalRep]: if not global_participant_ids: return [] stmt = sa.select(ArtistRosterLocalRep).where( ArtistRosterLocalRep.vendor_id == vendor_id, ArtistRosterLocalRep.subaccount_id == subaccount_id, ArtistRosterLocalRep.global_participant_id.in_(global_participant_ids), ) return self.db.session.execute(stmt).scalars().all()