from collections.abc import Sequence import sqlalchemy as sa from dmp.ad_reporting.models import ( AdReportingCampaignBenchmarkByAccountArtistCountryDbt, ) from dmp.adapters.db import ReportingRepository class AdReportingCampaignBenchmarkByAccountArtistCountryRepository( ReportingRepository[AdReportingCampaignBenchmarkByAccountArtistCountryDbt] ): def find_by_account_and_artist_id( self, vendor_id: int, subaccount_id: int, global_participant_id: str, ) -> Sequence[AdReportingCampaignBenchmarkByAccountArtistCountryDbt]: query = sa.select(AdReportingCampaignBenchmarkByAccountArtistCountryDbt).where( AdReportingCampaignBenchmarkByAccountArtistCountryDbt.vendor_id == vendor_id, AdReportingCampaignBenchmarkByAccountArtistCountryDbt.subaccount_id == subaccount_id, AdReportingCampaignBenchmarkByAccountArtistCountryDbt.global_participant_id == global_participant_id, ) return self.db.session.execute(query).scalars().all()