|  | @@ -103,6 +103,183 @@ class SP_ETL(SPClient,Common_ETLMethod):
 | 
											
												
													
														|  |          df_budget = self.TZ_Deal(df_budget,["usageUpdatedTimestamp"])
 |  |          df_budget = self.TZ_Deal(df_budget,["usageUpdatedTimestamp"])
 | 
											
												
													
														|  |          return self.columnsName_modify(df_budget)
 |  |          return self.columnsName_modify(df_budget)
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | 
 |  | +    def reportV3_campaign_spCampaignsETL(self,**params):
 | 
											
												
													
														|  | 
 |  | +        today = datetime.today()
 | 
											
												
													
														|  | 
 |  | +        if params.get("endDate")==None:
 | 
											
												
													
														|  | 
 |  | +            params["endDate"] = (datetime(today.year,today.month,today.day,tzinfo=timezone.utc)-timedelta(days=1)).strftime("%Y-%m-%d")
 | 
											
												
													
														|  | 
 |  | +        if params.get("startDate") ==None:
 | 
											
												
													
														|  | 
 |  | +            params["startDate"] = (datetime(today.year,today.month,today.day,tzinfo=timezone.utc)-timedelta(days=1)).strftime("%Y-%m-%d")
 | 
											
												
													
														|  | 
 |  | +        params['reportType'] = "spCampaigns"
 | 
											
												
													
														|  | 
 |  | +        params['columns'] = [
 | 
											
												
													
														|  | 
 |  | +            'campaignName', 'campaignId', 'campaignStatus', 'campaignBudgetAmount', 'campaignBudgetType',
 | 
											
												
													
														|  | 
 |  | +            'campaignRuleBasedBudgetAmount', 'campaignApplicableBudgetRuleId', 'campaignApplicableBudgetRuleName',
 | 
											
												
													
														|  | 
 |  | +            'campaignBudgetCurrencyCode', 'topOfSearchImpressionShare',
 | 
											
												
													
														|  | 
 |  | +            'impressions', 'clicks', 'cost', 'purchases1d', 'purchases7d', 'purchases14d', 'purchases30d', 'purchasesSameSku1d',
 | 
											
												
													
														|  | 
 |  | +            'purchasesSameSku7d', 'purchasesSameSku14d', 'purchasesSameSku30d', 'unitsSoldClicks1d', 'unitsSoldClicks7d',
 | 
											
												
													
														|  | 
 |  | +            'unitsSoldClicks14d', 'unitsSoldClicks30d', 'sales1d', 'sales7d', 'sales14d', 'sales30d', 'attributedSalesSameSku1d',
 | 
											
												
													
														|  | 
 |  | +            'attributedSalesSameSku7d', 'attributedSalesSameSku14d', 'attributedSalesSameSku30d', 'unitsSoldSameSku1d',
 | 
											
												
													
														|  | 
 |  | +            'unitsSoldSameSku7d', 'unitsSoldSameSku14d', 'unitsSoldSameSku30d', 'kindleEditionNormalizedPagesRead14d',
 | 
											
												
													
														|  | 
 |  | +            'kindleEditionNormalizedPagesRoyalties14d', 'date', 'campaignBiddingStrategy', 'costPerClick',
 | 
											
												
													
														|  | 
 |  | +            'clickThroughRate', 'spend'
 | 
											
												
													
														|  | 
 |  | +        ] #'startDate', 'endDate',
 | 
											
												
													
														|  | 
 |  | +        params['groupby'] = ['campaign']
 | 
											
												
													
														|  | 
 |  | +        params['timeUnit'] = 'DAILY'
 | 
											
												
													
														|  | 
 |  | +        list_report = self.get_v3_report(timeUnit=params['timeUnit'],groupby=params['groupby'],columns=params['columns'],startDate=params['startDate'],endDate=params['endDate'],reportType=params['reportType'])
 | 
											
												
													
														|  | 
 |  | +        # print(list_report)
 | 
											
												
													
														|  | 
 |  | +        df_report = pd.json_normalize(list_report)
 | 
											
												
													
														|  | 
 |  | +        return df_report
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +    def reportV3_adGroup_spCampaignsETL(self,**params):
 | 
											
												
													
														|  | 
 |  | +        today = datetime.today()
 | 
											
												
													
														|  | 
 |  | +        if params.get("endDate")==None:
 | 
											
												
													
														|  | 
 |  | +            params["endDate"] = (datetime(today.year,today.month,today.day,tzinfo=timezone.utc)-timedelta(days=1)).strftime("%Y-%m-%d")
 | 
											
												
													
														|  | 
 |  | +        if params.get("startDate") ==None:
 | 
											
												
													
														|  | 
 |  | +            params["startDate"] = (datetime(today.year,today.month,today.day,tzinfo=timezone.utc)-timedelta(days=1)).strftime("%Y-%m-%d")
 | 
											
												
													
														|  | 
 |  | +        params['reportType'] = "spCampaigns"
 | 
											
												
													
														|  | 
 |  | +        params['columns'] = [
 | 
											
												
													
														|  | 
 |  | +            'adGroupName', 'adGroupId', 'adStatus',
 | 
											
												
													
														|  | 
 |  | +            'impressions', 'clicks', 'cost', 'purchases1d', 'purchases7d', 'purchases14d', 'purchases30d', 'purchasesSameSku1d',
 | 
											
												
													
														|  | 
 |  | +            'purchasesSameSku7d', 'purchasesSameSku14d', 'purchasesSameSku30d', 'unitsSoldClicks1d', 'unitsSoldClicks7d',
 | 
											
												
													
														|  | 
 |  | +            'unitsSoldClicks14d', 'unitsSoldClicks30d', 'sales1d', 'sales7d', 'sales14d', 'sales30d', 'attributedSalesSameSku1d',
 | 
											
												
													
														|  | 
 |  | +            'attributedSalesSameSku7d', 'attributedSalesSameSku14d', 'attributedSalesSameSku30d', 'unitsSoldSameSku1d',
 | 
											
												
													
														|  | 
 |  | +            'unitsSoldSameSku7d', 'unitsSoldSameSku14d', 'unitsSoldSameSku30d', 'kindleEditionNormalizedPagesRead14d',
 | 
											
												
													
														|  | 
 |  | +            'kindleEditionNormalizedPagesRoyalties14d', 'date', 'campaignBiddingStrategy', 'costPerClick',
 | 
											
												
													
														|  | 
 |  | +            'clickThroughRate', 'spend'
 | 
											
												
													
														|  | 
 |  | +        ] #'startDate', 'endDate',
 | 
											
												
													
														|  | 
 |  | +        params['groupby'] = ['adGroup']
 | 
											
												
													
														|  | 
 |  | +        params['timeUnit'] = 'DAILY'
 | 
											
												
													
														|  | 
 |  | +        list_report = self.get_v3_report(timeUnit=params['timeUnit'],groupby=params['groupby'],columns=params['columns'],startDate=params['startDate'],endDate=params['endDate'],reportType=params['reportType'])
 | 
											
												
													
														|  | 
 |  | +        # print(list_report)
 | 
											
												
													
														|  | 
 |  | +        df_report = pd.json_normalize(list_report)
 | 
											
												
													
														|  | 
 |  | +        return df_report
 | 
											
												
													
														|  | 
 |  | +#
 | 
											
												
													
														|  | 
 |  | +    def reportV3_campaignPlacement_spCampaignsETL(self,**params):
 | 
											
												
													
														|  | 
 |  | +        today = datetime.today()
 | 
											
												
													
														|  | 
 |  | +        if params.get("endDate")==None:
 | 
											
												
													
														|  | 
 |  | +            params["endDate"] = (datetime(today.year,today.month,today.day,tzinfo=timezone.utc)-timedelta(days=1)).strftime("%Y-%m-%d")
 | 
											
												
													
														|  | 
 |  | +        if params.get("startDate") ==None:
 | 
											
												
													
														|  | 
 |  | +            params["startDate"] = (datetime(today.year,today.month,today.day,tzinfo=timezone.utc)-timedelta(days=1)).strftime("%Y-%m-%d")
 | 
											
												
													
														|  | 
 |  | +        params['reportType'] = "spCampaigns"
 | 
											
												
													
														|  | 
 |  | +        params['columns'] = [
 | 
											
												
													
														|  | 
 |  | +            'placementClassification',
 | 
											
												
													
														|  | 
 |  | +            'impressions', 'clicks', 'cost', 'purchases1d', 'purchases7d', 'purchases14d', 'purchases30d', 'purchasesSameSku1d',
 | 
											
												
													
														|  | 
 |  | +            'purchasesSameSku7d', 'purchasesSameSku14d', 'purchasesSameSku30d', 'unitsSoldClicks1d', 'unitsSoldClicks7d',
 | 
											
												
													
														|  | 
 |  | +            'unitsSoldClicks14d', 'unitsSoldClicks30d', 'sales1d', 'sales7d', 'sales14d', 'sales30d', 'attributedSalesSameSku1d',
 | 
											
												
													
														|  | 
 |  | +            'attributedSalesSameSku7d', 'attributedSalesSameSku14d', 'attributedSalesSameSku30d', 'unitsSoldSameSku1d',
 | 
											
												
													
														|  | 
 |  | +            'unitsSoldSameSku7d', 'unitsSoldSameSku14d', 'unitsSoldSameSku30d', 'kindleEditionNormalizedPagesRead14d',
 | 
											
												
													
														|  | 
 |  | +            'kindleEditionNormalizedPagesRoyalties14d', 'date', 'campaignBiddingStrategy', 'costPerClick',
 | 
											
												
													
														|  | 
 |  | +            'clickThroughRate', 'spend'
 | 
											
												
													
														|  | 
 |  | +        ] #'startDate', 'endDate',
 | 
											
												
													
														|  | 
 |  | +        params['groupby'] = ['campaignPlacement']
 | 
											
												
													
														|  | 
 |  | +        params['timeUnit'] = 'DAILY'
 | 
											
												
													
														|  | 
 |  | +        list_report = self.get_v3_report(timeUnit=params['timeUnit'],groupby=params['groupby'],columns=params['columns'],startDate=params['startDate'],endDate=params['endDate'],reportType=params['reportType'])
 | 
											
												
													
														|  | 
 |  | +        # print(list_report)
 | 
											
												
													
														|  | 
 |  | +        df_report = pd.json_normalize(list_report)
 | 
											
												
													
														|  | 
 |  | +        return df_report
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +    def reportV3_targeting_spTargetingETL(self,**params):
 | 
											
												
													
														|  | 
 |  | +        today = datetime.today()
 | 
											
												
													
														|  | 
 |  | +        if params.get("endDate")==None:
 | 
											
												
													
														|  | 
 |  | +            params["endDate"] = (datetime(today.year,today.month,today.day,tzinfo=timezone.utc)-timedelta(days=1)).strftime("%Y-%m-%d")
 | 
											
												
													
														|  | 
 |  | +        if params.get("startDate") ==None:
 | 
											
												
													
														|  | 
 |  | +            params["startDate"] = (datetime(today.year,today.month,today.day,tzinfo=timezone.utc)-timedelta(days=1)).strftime("%Y-%m-%d")
 | 
											
												
													
														|  | 
 |  | +        params['reportType'] = "spTargeting"
 | 
											
												
													
														|  | 
 |  | +        params['columns'] = [
 | 
											
												
													
														|  | 
 |  | +            'adKeywordStatus',
 | 
											
												
													
														|  | 
 |  | +            'impressions', 'clicks', 'costPerClick', 'clickThroughRate', 'cost', 'purchases1d', 'purchases7d', 'purchases14d',
 | 
											
												
													
														|  | 
 |  | +            'purchases30d', 'purchasesSameSku1d', 'purchasesSameSku7d', 'purchasesSameSku14d', 'purchasesSameSku30d',
 | 
											
												
													
														|  | 
 |  | +            'unitsSoldClicks1d', 'unitsSoldClicks7d', 'unitsSoldClicks14d', 'unitsSoldClicks30d', 'sales1d', 'sales7d', 'sales14d',
 | 
											
												
													
														|  | 
 |  | +            'sales30d', 'attributedSalesSameSku1d', 'attributedSalesSameSku7d', 'attributedSalesSameSku14d',
 | 
											
												
													
														|  | 
 |  | +            'attributedSalesSameSku30d', 'unitsSoldSameSku1d', 'unitsSoldSameSku7d', 'unitsSoldSameSku14d', 'unitsSoldSameSku30d',
 | 
											
												
													
														|  | 
 |  | +            'kindleEditionNormalizedPagesRead14d', 'kindleEditionNormalizedPagesRoyalties14d', 'salesOtherSku7d',
 | 
											
												
													
														|  | 
 |  | +            'unitsSoldOtherSku7d', 'acosClicks7d', 'acosClicks14d', 'roasClicks7d', 'roasClicks14d', 'keywordId', 'keyword',
 | 
											
												
													
														|  | 
 |  | +            'campaignBudgetCurrencyCode', 'date', 'portfolioId', 'campaignName', 'campaignId',
 | 
											
												
													
														|  | 
 |  | +            'campaignBudgetType', 'campaignBudgetAmount', 'campaignStatus', 'keywordBid', 'adGroupName', 'adGroupId', 'keywordType',
 | 
											
												
													
														|  | 
 |  | +            'matchType', 'targeting', 'topOfSearchImpressionShare'
 | 
											
												
													
														|  | 
 |  | +        ] #'startDate', 'endDate',
 | 
											
												
													
														|  | 
 |  | +        params['groupby'] = ['targeting']
 | 
											
												
													
														|  | 
 |  | +        params['timeUnit'] = 'DAILY'
 | 
											
												
													
														|  | 
 |  | +        list_report = self.get_v3_report(timeUnit=params['timeUnit'],groupby=params['groupby'],columns=params['columns'],startDate=params['startDate'],endDate=params['endDate'],reportType=params['reportType'])
 | 
											
												
													
														|  | 
 |  | +        # print(list_report)
 | 
											
												
													
														|  | 
 |  | +        df_report = pd.json_normalize(list_report)
 | 
											
												
													
														|  | 
 |  | +        return df_report
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +    def reportV3_searchTerm_spSearchTermETL(self,**params):
 | 
											
												
													
														|  | 
 |  | +        today = datetime.today()
 | 
											
												
													
														|  | 
 |  | +        if params.get("endDate")==None:
 | 
											
												
													
														|  | 
 |  | +            params["endDate"] = (datetime(today.year,today.month,today.day,tzinfo=timezone.utc)-timedelta(days=1)).strftime("%Y-%m-%d")
 | 
											
												
													
														|  | 
 |  | +        if params.get("startDate") ==None:
 | 
											
												
													
														|  | 
 |  | +            params["startDate"] = (datetime(today.year,today.month,today.day,tzinfo=timezone.utc)-timedelta(days=1)).strftime("%Y-%m-%d")
 | 
											
												
													
														|  | 
 |  | +        params['reportType'] = "spSearchTerm"
 | 
											
												
													
														|  | 
 |  | +        params['columns'] = [
 | 
											
												
													
														|  | 
 |  | +            'adKeywordStatus',
 | 
											
												
													
														|  | 
 |  | +            'impressions', 'clicks', 'costPerClick', 'clickThroughRate', 'cost', 'purchases1d', 'purchases7d', 'purchases14d',
 | 
											
												
													
														|  | 
 |  | +            'purchases30d', 'purchasesSameSku1d', 'purchasesSameSku7d', 'purchasesSameSku14d', 'purchasesSameSku30d',
 | 
											
												
													
														|  | 
 |  | +            'unitsSoldClicks1d', 'unitsSoldClicks7d', 'unitsSoldClicks14d', 'unitsSoldClicks30d', 'sales1d', 'sales7d', 'sales14d',
 | 
											
												
													
														|  | 
 |  | +            'sales30d', 'attributedSalesSameSku1d', 'attributedSalesSameSku7d', 'attributedSalesSameSku14d',
 | 
											
												
													
														|  | 
 |  | +            'attributedSalesSameSku30d', 'unitsSoldSameSku1d', 'unitsSoldSameSku7d', 'unitsSoldSameSku14d', 'unitsSoldSameSku30d',
 | 
											
												
													
														|  | 
 |  | +            'kindleEditionNormalizedPagesRead14d', 'kindleEditionNormalizedPagesRoyalties14d', 'salesOtherSku7d',
 | 
											
												
													
														|  | 
 |  | +            'unitsSoldOtherSku7d', 'acosClicks7d', 'acosClicks14d', 'roasClicks7d', 'roasClicks14d', 'keywordId', 'keyword',
 | 
											
												
													
														|  | 
 |  | +            'campaignBudgetCurrencyCode', 'date',  'portfolioId', 'searchTerm', 'campaignName', 'campaignId',
 | 
											
												
													
														|  | 
 |  | +            'campaignBudgetType', 'campaignBudgetAmount', 'campaignStatus', 'keywordBid', 'adGroupName', 'adGroupId', 'keywordType',
 | 
											
												
													
														|  | 
 |  | +            'matchType', 'targeting'
 | 
											
												
													
														|  | 
 |  | +        ] #'startDate', 'endDate',
 | 
											
												
													
														|  | 
 |  | +        params['groupby'] = ['searchTerm']
 | 
											
												
													
														|  | 
 |  | +        params['timeUnit'] = 'DAILY'
 | 
											
												
													
														|  | 
 |  | +        list_report = self.get_v3_report(timeUnit=params['timeUnit'],groupby=params['groupby'],columns=params['columns'],startDate=params['startDate'],endDate=params['endDate'],reportType=params['reportType'])
 | 
											
												
													
														|  | 
 |  | +        # print(list_report)
 | 
											
												
													
														|  | 
 |  | +        df_report = pd.json_normalize(list_report)
 | 
											
												
													
														|  | 
 |  | +        return df_report
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +    def reportV3_advertiser_spAdvertisedProductETL(self,**params):
 | 
											
												
													
														|  | 
 |  | +        today = datetime.today()
 | 
											
												
													
														|  | 
 |  | +        if params.get("endDate")==None:
 | 
											
												
													
														|  | 
 |  | +            params["endDate"] = (datetime(today.year,today.month,today.day,tzinfo=timezone.utc)-timedelta(days=1)).strftime("%Y-%m-%d")
 | 
											
												
													
														|  | 
 |  | +        if params.get("startDate") ==None:
 | 
											
												
													
														|  | 
 |  | +            params["startDate"] = (datetime(today.year,today.month,today.day,tzinfo=timezone.utc)-timedelta(days=1)).strftime("%Y-%m-%d")
 | 
											
												
													
														|  | 
 |  | +        params['reportType'] = "spAdvertisedProduct"
 | 
											
												
													
														|  | 
 |  | +        params['columns'] = [
 | 
											
												
													
														|  | 
 |  | +            'date', 'campaignName', 'campaignId', 'adGroupName', 'adGroupId', 'adId', 'portfolioId', 'impressions',
 | 
											
												
													
														|  | 
 |  | +            'clicks', 'costPerClick', 'clickThroughRate', 'cost', 'spend', 'campaignBudgetCurrencyCode', 'campaignBudgetAmount',
 | 
											
												
													
														|  | 
 |  | +            'campaignBudgetType', 'campaignStatus', 'advertisedAsin', 'advertisedSku', 'purchases1d', 'purchases7d', 'purchases14d',
 | 
											
												
													
														|  | 
 |  | +            'purchases30d', 'purchasesSameSku1d', 'purchasesSameSku7d', 'purchasesSameSku14d', 'purchasesSameSku30d',
 | 
											
												
													
														|  | 
 |  | +            'unitsSoldClicks1d', 'unitsSoldClicks7d', 'unitsSoldClicks14d', 'unitsSoldClicks30d', 'sales1d', 'sales7d', 'sales14d',
 | 
											
												
													
														|  | 
 |  | +            'sales30d', 'attributedSalesSameSku1d', 'attributedSalesSameSku7d', 'attributedSalesSameSku14d',
 | 
											
												
													
														|  | 
 |  | +            'attributedSalesSameSku30d', 'salesOtherSku7d', 'unitsSoldSameSku1d', 'unitsSoldSameSku7d', 'unitsSoldSameSku14d',
 | 
											
												
													
														|  | 
 |  | +            'unitsSoldSameSku30d', 'unitsSoldOtherSku7d', 'kindleEditionNormalizedPagesRead14d',
 | 
											
												
													
														|  | 
 |  | +            'kindleEditionNormalizedPagesRoyalties14d', 'acosClicks7d', 'acosClicks14d', 'roasClicks7d', 'roasClicks14d'
 | 
											
												
													
														|  | 
 |  | +        ] #'startDate', 'endDate',
 | 
											
												
													
														|  | 
 |  | +        params['groupby'] = ['advertiser']
 | 
											
												
													
														|  | 
 |  | +        params['timeUnit'] = 'DAILY'
 | 
											
												
													
														|  | 
 |  | +        list_report = self.get_v3_report(timeUnit=params['timeUnit'],groupby=params['groupby'],columns=params['columns'],startDate=params['startDate'],endDate=params['endDate'],reportType=params['reportType'])
 | 
											
												
													
														|  | 
 |  | +        # print(list_report)
 | 
											
												
													
														|  | 
 |  | +        df_report = pd.json_normalize(list_report)
 | 
											
												
													
														|  | 
 |  | +        return df_report
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +    def reportV3_asin_spPurchasedProductETL(self,**params):
 | 
											
												
													
														|  | 
 |  | +        today = datetime.today()
 | 
											
												
													
														|  | 
 |  | +        if params.get("endDate")==None:
 | 
											
												
													
														|  | 
 |  | +            params["endDate"] = (datetime(today.year,today.month,today.day,tzinfo=timezone.utc)-timedelta(days=1)).strftime("%Y-%m-%d")
 | 
											
												
													
														|  | 
 |  | +        if params.get("startDate") ==None:
 | 
											
												
													
														|  | 
 |  | +            params["startDate"] = (datetime(today.year,today.month,today.day,tzinfo=timezone.utc)-timedelta(days=1)).strftime("%Y-%m-%d")
 | 
											
												
													
														|  | 
 |  | +        params['reportType'] = "spPurchasedProduct"
 | 
											
												
													
														|  | 
 |  | +        params['columns'] = [
 | 
											
												
													
														|  | 
 |  | +            'date',  'portfolioId', 'campaignName', 'campaignId', 'adGroupName', 'adGroupId', 'keywordId', 'keyword',
 | 
											
												
													
														|  | 
 |  | +            'keywordType', 'advertisedAsin', 'purchasedAsin', 'advertisedSku', 'campaignBudgetCurrencyCode', 'matchType',
 | 
											
												
													
														|  | 
 |  | +            'unitsSoldClicks1d', 'unitsSoldClicks7d', 'unitsSoldClicks14d', 'unitsSoldClicks30d', 'sales1d', 'sales7d', 'sales14d',
 | 
											
												
													
														|  | 
 |  | +            'sales30d', 'purchases1d', 'purchases7d', 'purchases14d', 'purchases30d', 'unitsSoldOtherSku1d', 'unitsSoldOtherSku7d',
 | 
											
												
													
														|  | 
 |  | +            'unitsSoldOtherSku14d', 'unitsSoldOtherSku30d', 'salesOtherSku1d', 'salesOtherSku7d', 'salesOtherSku14d',
 | 
											
												
													
														|  | 
 |  | +            'salesOtherSku30d', 'purchasesOtherSku1d', 'purchasesOtherSku7d', 'purchasesOtherSku14d', 'purchasesOtherSku30d',
 | 
											
												
													
														|  | 
 |  | +            'kindleEditionNormalizedPagesRead14d', 'kindleEditionNormalizedPagesRoyalties14d'
 | 
											
												
													
														|  | 
 |  | +        ] #'startDate', 'endDate',
 | 
											
												
													
														|  | 
 |  | +        params['groupby'] = ['asin']
 | 
											
												
													
														|  | 
 |  | +        params['timeUnit'] = 'DAILY'
 | 
											
												
													
														|  | 
 |  | +        list_report = self.get_v3_report(timeUnit=params['timeUnit'],groupby=params['groupby'],columns=params['columns'],startDate=params['startDate'],endDate=params['endDate'],reportType=params['reportType'])
 | 
											
												
													
														|  | 
 |  | +        # print(list_report)
 | 
											
												
													
														|  | 
 |  | +        df_report = pd.json_normalize(list_report)
 | 
											
												
													
														|  | 
 |  | +        return df_report
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |  class SB_ETL(SBClient,Common_ETLMethod):
 |  |  class SB_ETL(SBClient,Common_ETLMethod):
 | 
											
												
													
														|  |      def campaigns_ETL(self):
 |  |      def campaigns_ETL(self):
 | 
											
												
													
														|  |          list_campaign_SB = list(self.iter_campaigns(**{"includeExtendedDataFields":True}))
 |  |          list_campaign_SB = list(self.iter_campaigns(**{"includeExtendedDataFields":True}))
 | 
											
										
											
												
													
														|  | @@ -184,6 +361,26 @@ class SB_ETL(SBClient,Common_ETLMethod):
 | 
											
												
													
														|  |          df_report = pd.json_normalize(list_report)
 |  |          df_report = pd.json_normalize(list_report)
 | 
											
												
													
														|  |          return df_report
 |  |          return df_report
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | 
 |  | +    def reportV2_campaignsVideo_ETL(self,**params):
 | 
											
												
													
														|  | 
 |  | +        today = datetime.today()
 | 
											
												
													
														|  | 
 |  | +        if params.get("date")==None:
 | 
											
												
													
														|  | 
 |  | +            params["date"] = (datetime(today.year,today.month,today.day,tzinfo=timezone.utc)-timedelta(days=1)).strftime("%Y%m%d")
 | 
											
												
													
														|  | 
 |  | +        params['record_type']='campaigns'
 | 
											
												
													
														|  | 
 |  | +        if params.get('metrics')==None:
 | 
											
												
													
														|  | 
 |  | +            params['metrics'] = [
 | 
											
												
													
														|  | 
 |  | +                'attributedConversions14d', 'attributedConversions14dSameSKU', 'attributedSales14d', 'attributedSales14dSameSKU',
 | 
											
												
													
														|  | 
 |  | +                'campaignBudget', 'campaignBudgetType', 'campaignId', 'campaignName', 'campaignStatus', 'clicks', 'cost', 'dpv14d', 'impressions',
 | 
											
												
													
														|  | 
 |  | +                'vctr', 'video5SecondViewRate', 'video5SecondViews', 'videoCompleteViews', 'videoFirstQuartileViews', 'videoMidpointViews',
 | 
											
												
													
														|  | 
 |  | +                'videoThirdQuartileViews', 'videoUnmutes', 'viewableImpressions', 'vtr', 'dpv14d', 'attributedDetailPageViewsClicks14d',
 | 
											
												
													
														|  | 
 |  | +                'attributedOrderRateNewToBrand14d', 'attributedOrdersNewToBrand14d', 'attributedOrdersNewToBrandPercentage14d',
 | 
											
												
													
														|  | 
 |  | +                'attributedSalesNewToBrand14d', 'attributedSalesNewToBrandPercentage14d', 'attributedUnitsOrderedNewToBrand14d',
 | 
											
												
													
														|  | 
 |  | +                'attributedUnitsOrderedNewToBrandPercentage14d', 'attributedBrandedSearches14d', 'currency', 'topOfSearchImpressionShare'
 | 
											
												
													
														|  | 
 |  | +            ]
 | 
											
												
													
														|  | 
 |  | +        list_report = self.get_v2_report(record_type=params['record_type'],report_date=params["date"],metrics=params['metrics'],creative_type='video')
 | 
											
												
													
														|  | 
 |  | +        # print(list_report)
 | 
											
												
													
														|  | 
 |  | +        df_report = pd.json_normalize(list_report)
 | 
											
												
													
														|  | 
 |  | +        return df_report
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |      def reportV2_placementRecord_ETL(self,**params):
 |  |      def reportV2_placementRecord_ETL(self,**params):
 | 
											
												
													
														|  |          today = datetime.today()
 |  |          today = datetime.today()
 | 
											
												
													
														|  |          if params.get("date")==None:
 |  |          if params.get("date")==None:
 | 
											
										
											
												
													
														|  | @@ -207,6 +404,26 @@ class SB_ETL(SBClient,Common_ETLMethod):
 | 
											
												
													
														|  |          df_report = pd.json_normalize(list_report)
 |  |          df_report = pd.json_normalize(list_report)
 | 
											
												
													
														|  |          return df_report
 |  |          return df_report
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | 
 |  | +    def reportV2_placementVideo_ETL(self,**params):
 | 
											
												
													
														|  | 
 |  | +        today = datetime.today()
 | 
											
												
													
														|  | 
 |  | +        if params.get("date")==None:
 | 
											
												
													
														|  | 
 |  | +            params["date"] = (datetime(today.year,today.month,today.day,tzinfo=timezone.utc)-timedelta(days=1)).strftime("%Y%m%d")
 | 
											
												
													
														|  | 
 |  | +        params['record_type']='campaigns'
 | 
											
												
													
														|  | 
 |  | +        if params.get('metrics')==None:
 | 
											
												
													
														|  | 
 |  | +            params['metrics'] = [
 | 
											
												
													
														|  | 
 |  | +                'attributedConversions14d', 'attributedConversions14dSameSKU', 'attributedSales14d', 'attributedSales14dSameSKU', 'campaignBudget',
 | 
											
												
													
														|  | 
 |  | +                'campaignBudgetType', 'campaignId', 'campaignName', 'campaignStatus', 'clicks', 'cost', 'impressions', 'vctr', 'video5SecondViewRate',
 | 
											
												
													
														|  | 
 |  | +                'video5SecondViews', 'videoCompleteViews', 'videoFirstQuartileViews', 'videoMidpointViews', 'videoThirdQuartileViews', 'videoUnmutes',
 | 
											
												
													
														|  | 
 |  | +                'viewableImpressions', 'vtr', 'dpv14d', 'attributedDetailPageViewsClicks14d', 'attributedOrderRateNewToBrand14d', 'attributedOrdersNewToBrand14d',
 | 
											
												
													
														|  | 
 |  | +                'attributedOrdersNewToBrandPercentage14d', 'attributedSalesNewToBrand14d', 'attributedSalesNewToBrandPercentage14d', 'attributedUnitsOrderedNewToBrand14d',
 | 
											
												
													
														|  | 
 |  | +                'attributedUnitsOrderedNewToBrandPercentage14d', 'attributedBrandedSearches14d', 'currency'
 | 
											
												
													
														|  | 
 |  | +                ] #'placement'
 | 
											
												
													
														|  | 
 |  | +        # print(date)
 | 
											
												
													
														|  | 
 |  | +        list_report = self.get_v2_report(record_type=params['record_type'],report_date=params["date"],metrics=params['metrics'],segment='placement',creative_type='video')
 | 
											
												
													
														|  | 
 |  | +        # print(list_report)
 | 
											
												
													
														|  | 
 |  | +        df_report = pd.json_normalize(list_report)
 | 
											
												
													
														|  | 
 |  | +        return df_report
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |      def reportV2_adGroupsRecord_ETL(self,**params):
 |  |      def reportV2_adGroupsRecord_ETL(self,**params):
 | 
											
												
													
														|  |          today = datetime.today()
 |  |          today = datetime.today()
 | 
											
												
													
														|  |          if params.get("date")==None:
 |  |          if params.get("date")==None:
 | 
											
										
											
												
													
														|  | @@ -226,6 +443,47 @@ class SB_ETL(SBClient,Common_ETLMethod):
 | 
											
												
													
														|  |          df_report = pd.json_normalize(list_report)
 |  |          df_report = pd.json_normalize(list_report)
 | 
											
												
													
														|  |          return df_report
 |  |          return df_report
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | 
 |  | +    def reportV2_adGroupsVideo_ETL(self,**params):
 | 
											
												
													
														|  | 
 |  | +        today = datetime.today()
 | 
											
												
													
														|  | 
 |  | +        if params.get("date")==None:
 | 
											
												
													
														|  | 
 |  | +            params["date"] = (datetime(today.year,today.month,today.day,tzinfo=timezone.utc)-timedelta(days=1)).strftime("%Y%m%d")
 | 
											
												
													
														|  | 
 |  | +        params['record_type']='adGroups'
 | 
											
												
													
														|  | 
 |  | +        if params.get('metrics')==None:
 | 
											
												
													
														|  | 
 |  | +            params['metrics'] = [
 | 
											
												
													
														|  | 
 |  | +                'adGroupId', 'adGroupName', 'attributedConversions14d', 'attributedConversions14dSameSKU', 'attributedSales14d', 'attributedSales14dSameSKU',
 | 
											
												
													
														|  | 
 |  | +                'campaignBudget', 'campaignBudgetType', 'campaignId' ,'campaignName', 'campaignStatus', 'clicks', 'cost', 'impressions', 'vctr', 'video5SecondViewRate',
 | 
											
												
													
														|  | 
 |  | +                'video5SecondViews', 'videoCompleteViews', 'videoFirstQuartileViews', 'videoMidpointViews', 'videoThirdQuartileViews', 'videoUnmutes',
 | 
											
												
													
														|  | 
 |  | +                'viewableImpressions', 'vtr', 'dpv14d', 'attributedDetailPageViewsClicks14d', 'attributedOrderRateNewToBrand14d', 'attributedOrdersNewToBrand14d',
 | 
											
												
													
														|  | 
 |  | +                'attributedOrdersNewToBrandPercentage14d', 'attributedSalesNewToBrand14d', 'attributedSalesNewToBrandPercentage14d', 'attributedUnitsOrderedNewToBrand14d',
 | 
											
												
													
														|  | 
 |  | +                'attributedUnitsOrderedNewToBrandPercentage14d', 'attributedBrandedSearches14d', 'currency'
 | 
											
												
													
														|  | 
 |  | +                ] #
 | 
											
												
													
														|  | 
 |  | +        # print(date)
 | 
											
												
													
														|  | 
 |  | +        list_report = self.get_v2_report(record_type=params['record_type'],report_date=params["date"],metrics=params['metrics'],creative_type='video')
 | 
											
												
													
														|  | 
 |  | +        # print(list_report)
 | 
											
												
													
														|  | 
 |  | +        df_report = pd.json_normalize(list_report)
 | 
											
												
													
														|  | 
 |  | +        return df_report
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +    def reportV2_adGroupsVideo_ETL(self,**params):
 | 
											
												
													
														|  | 
 |  | +        today = datetime.today()
 | 
											
												
													
														|  | 
 |  | +        if params.get("date")==None:
 | 
											
												
													
														|  | 
 |  | +            params["date"] = (datetime(today.year,today.month,today.day,tzinfo=timezone.utc)-timedelta(days=1)).strftime("%Y%m%d")
 | 
											
												
													
														|  | 
 |  | +        params['record_type']='adGroups'
 | 
											
												
													
														|  | 
 |  | +        if params.get('metrics')==None:
 | 
											
												
													
														|  | 
 |  | +            params['metrics'] = [
 | 
											
												
													
														|  | 
 |  | +                'adGroupId', 'adGroupName', 'attributedConversions14d', 'attributedConversions14dSameSKU', 'attributedSales14d', 'attributedSales14dSameSKU',
 | 
											
												
													
														|  | 
 |  | +                'campaignBudget', 'campaignBudgetType', 'campaignId' ,'campaignName', 'campaignStatus', 'clicks', 'cost', 'impressions', 'vctr', 'video5SecondViewRate',
 | 
											
												
													
														|  | 
 |  | +                'video5SecondViews', 'videoCompleteViews', 'videoFirstQuartileViews', 'videoMidpointViews', 'videoThirdQuartileViews', 'videoUnmutes',
 | 
											
												
													
														|  | 
 |  | +                'viewableImpressions', 'vtr', 'dpv14d', 'attributedDetailPageViewsClicks14d', 'attributedOrderRateNewToBrand14d', 'attributedOrdersNewToBrand14d',
 | 
											
												
													
														|  | 
 |  | +                'attributedOrdersNewToBrandPercentage14d', 'attributedSalesNewToBrand14d', 'attributedSalesNewToBrandPercentage14d', 'attributedUnitsOrderedNewToBrand14d',
 | 
											
												
													
														|  | 
 |  | +                'attributedUnitsOrderedNewToBrandPercentage14d', 'attributedBrandedSearches14d', 'currency'
 | 
											
												
													
														|  | 
 |  | +                ] #
 | 
											
												
													
														|  | 
 |  | +        # print(date)
 | 
											
												
													
														|  | 
 |  | +        list_report = self.get_v2_report(record_type=params['record_type'],report_date=params["date"],metrics=params['metrics'],creative_type='video')
 | 
											
												
													
														|  | 
 |  | +        # print(list_report)
 | 
											
												
													
														|  | 
 |  | +        df_report = pd.json_normalize(list_report)
 | 
											
												
													
														|  | 
 |  | +        return df_report
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |      def reportV2_targetsRecord_ETL(self,**params):
 |  |      def reportV2_targetsRecord_ETL(self,**params):
 | 
											
												
													
														|  |          today = datetime.today()
 |  |          today = datetime.today()
 | 
											
												
													
														|  |          if params.get("date")==None:
 |  |          if params.get("date")==None:
 | 
											
										
											
												
													
														|  | @@ -245,6 +503,30 @@ class SB_ETL(SBClient,Common_ETLMethod):
 | 
											
												
													
														|  |          df_report = pd.json_normalize(list_report)
 |  |          df_report = pd.json_normalize(list_report)
 | 
											
												
													
														|  |          return df_report
 |  |          return df_report
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | 
 |  | +    def reportV2_targetsVideo_ETL(self,**params):
 | 
											
												
													
														|  | 
 |  | +        today = datetime.today()
 | 
											
												
													
														|  | 
 |  | +        if params.get("date")==None:
 | 
											
												
													
														|  | 
 |  | +            params["date"] = (datetime(today.year,today.month,today.day,tzinfo=timezone.utc)-timedelta(days=1)).strftime("%Y%m%d")
 | 
											
												
													
														|  | 
 |  | +        params['record_type']='targets'
 | 
											
												
													
														|  | 
 |  | +        if params.get('metrics')==None:
 | 
											
												
													
														|  | 
 |  | +            params['metrics'] = [
 | 
											
												
													
														|  | 
 |  | +                'adGroupId', 'adGroupName', 'attributedConversions14d', 'attributedConversions14dSameSKU', 'attributedSales14d',
 | 
											
												
													
														|  | 
 |  | +                'attributedSales14dSameSKU', 'campaignBudget', 'campaignBudgetType', 'campaignId', 'campaignName', 'campaignStatus',
 | 
											
												
													
														|  | 
 |  | +                'clicks', 'cost', 'impressions', 'targetId', 'targetingExpression', 'targetingText', 'targetingType', 'vctr',
 | 
											
												
													
														|  | 
 |  | +                'video5SecondViewRate', 'video5SecondViews', 'videoCompleteViews', 'videoFirstQuartileViews',
 | 
											
												
													
														|  | 
 |  | +                'videoMidpointViews', 'videoThirdQuartileViews', 'videoUnmutes', 'viewableImpressions', 'vtr', 'dpv14d',
 | 
											
												
													
														|  | 
 |  | +                'attributedDetailPageViewsClicks14d', 'attributedOrderRateNewToBrand14d', 'attributedOrdersNewToBrand14d',
 | 
											
												
													
														|  | 
 |  | +                'attributedOrdersNewToBrandPercentage14d', 'attributedSalesNewToBrand14d',
 | 
											
												
													
														|  | 
 |  | +                'attributedSalesNewToBrandPercentage14d', 'attributedUnitsOrderedNewToBrand14d',
 | 
											
												
													
														|  | 
 |  | +                'attributedUnitsOrderedNewToBrandPercentage14d', 'attributedBrandedSearches14d', 'currency',
 | 
											
												
													
														|  | 
 |  | +                'topOfSearchImpressionShare'
 | 
											
												
													
														|  | 
 |  | +                ] #
 | 
											
												
													
														|  | 
 |  | +        # print(date)
 | 
											
												
													
														|  | 
 |  | +        list_report = self.get_v2_report(record_type=params['record_type'],report_date=params["date"],metrics=params['metrics'],creative_type='video')
 | 
											
												
													
														|  | 
 |  | +        # print(list_report)
 | 
											
												
													
														|  | 
 |  | +        df_report = pd.json_normalize(list_report)
 | 
											
												
													
														|  | 
 |  | +        return df_report
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |      def reportV2_keywordsRecord_ETL(self,**params):
 |  |      def reportV2_keywordsRecord_ETL(self,**params):
 | 
											
												
													
														|  |          today = datetime.today()
 |  |          today = datetime.today()
 | 
											
												
													
														|  |          if params.get("date")==None:
 |  |          if params.get("date")==None:
 | 
											
										
											
												
													
														|  | @@ -265,6 +547,30 @@ class SB_ETL(SBClient,Common_ETLMethod):
 | 
											
												
													
														|  |          df_report = pd.json_normalize(list_report)
 |  |          df_report = pd.json_normalize(list_report)
 | 
											
												
													
														|  |          return df_report
 |  |          return df_report
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | 
 |  | +    def reportV2_keywordsVideo_ETL(self,**params):
 | 
											
												
													
														|  | 
 |  | +        today = datetime.today()
 | 
											
												
													
														|  | 
 |  | +        if params.get("date")==None:
 | 
											
												
													
														|  | 
 |  | +            params["date"] = (datetime(today.year,today.month,today.day,tzinfo=timezone.utc)-timedelta(days=1)).strftime("%Y%m%d")
 | 
											
												
													
														|  | 
 |  | +        params['record_type']='keywords'
 | 
											
												
													
														|  | 
 |  | +        if params.get('metrics')==None:
 | 
											
												
													
														|  | 
 |  | +            params['metrics'] = [
 | 
											
												
													
														|  | 
 |  | +                'adGroupId', 'adGroupName', 'attributedConversions14d', 'attributedConversions14dSameSKU', 'attributedSales14d',
 | 
											
												
													
														|  | 
 |  | +                'attributedSales14dSameSKU', 'campaignBudget', 'campaignBudgetType', 'campaignId', 'campaignName', 'campaignStatus',
 | 
											
												
													
														|  | 
 |  | +                'clicks', 'cost', 'impressions', 'keywordBid', 'keywordId', 'keywordStatus', 'keywordText', 'matchType', 'vctr',
 | 
											
												
													
														|  | 
 |  | +                'video5SecondViewRate', 'video5SecondViews', 'videoCompleteViews', 'videoFirstQuartileViews',
 | 
											
												
													
														|  | 
 |  | +                'videoMidpointViews', 'videoThirdQuartileViews', 'videoUnmutes', 'viewableImpressions', 'vtr', 'dpv14d',
 | 
											
												
													
														|  | 
 |  | +                'attributedDetailPageViewsClicks14d', 'attributedOrderRateNewToBrand14d', 'attributedOrdersNewToBrand14d',
 | 
											
												
													
														|  | 
 |  | +                'attributedOrdersNewToBrandPercentage14d', 'attributedSalesNewToBrand14d',
 | 
											
												
													
														|  | 
 |  | +                'attributedSalesNewToBrandPercentage14d', 'attributedUnitsOrderedNewToBrand14d',
 | 
											
												
													
														|  | 
 |  | +                'attributedUnitsOrderedNewToBrandPercentage14d', 'attributedBrandedSearches14d', 'currency',
 | 
											
												
													
														|  | 
 |  | +                'topOfSearchImpressionShare'
 | 
											
												
													
														|  | 
 |  | +                ] #
 | 
											
												
													
														|  | 
 |  | +        # print(date)
 | 
											
												
													
														|  | 
 |  | +        list_report = self.get_v2_report(record_type=params['record_type'],report_date=params["date"],metrics=params['metrics'],creative_type='video')
 | 
											
												
													
														|  | 
 |  | +        # print(list_campaigns_report)
 | 
											
												
													
														|  | 
 |  | +        df_report = pd.json_normalize(list_report)
 | 
											
												
													
														|  | 
 |  | +        return df_report
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |      def reportV2_searchtermsRecord_ETL(self,**params):
 |  |      def reportV2_searchtermsRecord_ETL(self,**params):
 | 
											
												
													
														|  |          today = datetime.today()
 |  |          today = datetime.today()
 | 
											
												
													
														|  |          if params.get("date")==None:
 |  |          if params.get("date")==None:
 | 
											
										
											
												
													
														|  | @@ -283,6 +589,25 @@ class SB_ETL(SBClient,Common_ETLMethod):
 | 
											
												
													
														|  |          df_report = pd.json_normalize(list_report)
 |  |          df_report = pd.json_normalize(list_report)
 | 
											
												
													
														|  |          return df_report
 |  |          return df_report
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | 
 |  | +    def reportV2_searchtermsVideo_ETL(self,**params):
 | 
											
												
													
														|  | 
 |  | +        today = datetime.today()
 | 
											
												
													
														|  | 
 |  | +        if params.get("date")==None:
 | 
											
												
													
														|  | 
 |  | +            params["date"] = (datetime(today.year,today.month,today.day,tzinfo=timezone.utc)-timedelta(days=1)).strftime("%Y%m%d")
 | 
											
												
													
														|  | 
 |  | +        params['record_type']='keywords'
 | 
											
												
													
														|  | 
 |  | +        if params.get('metrics')==None:
 | 
											
												
													
														|  | 
 |  | +            params['metrics'] = [
 | 
											
												
													
														|  | 
 |  | +                'adGroupId', 'adGroupName', 'attributedConversions14d', 'attributedSales14d', 'campaignBudget',
 | 
											
												
													
														|  | 
 |  | +                'campaignBudgetType', 'campaignStatus', 'clicks', 'cost', 'impressions', 'keywordBid', 'keywordId', 'keywordStatus',
 | 
											
												
													
														|  | 
 |  | +                'keywordText', 'matchType',  'vctr', 'video5SecondViewRate', 'video5SecondViews', 'videoCompleteViews',
 | 
											
												
													
														|  | 
 |  | +                'videoFirstQuartileViews', 'videoMidpointViews', 'videoThirdQuartileViews', 'videoUnmutes', 'viewableImpressions',
 | 
											
												
													
														|  | 
 |  | +                'vtr',
 | 
											
												
													
														|  | 
 |  | +                ] #'query','currency'
 | 
											
												
													
														|  | 
 |  | +        # print(date)
 | 
											
												
													
														|  | 
 |  | +        list_report = self.get_v2_report(record_type=params['record_type'],report_date=params["date"],metrics=params['metrics'],segment='query',creative_type='video')
 | 
											
												
													
														|  | 
 |  | +        # print(list_report)
 | 
											
												
													
														|  | 
 |  | +        df_report = pd.json_normalize(list_report)
 | 
											
												
													
														|  | 
 |  | +        return df_report
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |      def reportV2_adsRecord_ETL(self,**params):
 |  |      def reportV2_adsRecord_ETL(self,**params):
 | 
											
												
													
														|  |          today = datetime.today()
 |  |          today = datetime.today()
 | 
											
												
													
														|  |          if params.get("date")==None:
 |  |          if params.get("date")==None:
 | 
											
										
											
												
													
														|  | @@ -302,6 +627,30 @@ class SB_ETL(SBClient,Common_ETLMethod):
 | 
											
												
													
														|  |          df_report = pd.json_normalize(list_report)
 |  |          df_report = pd.json_normalize(list_report)
 | 
											
												
													
														|  |          return df_report
 |  |          return df_report
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | 
 |  | +    def reportV2_adsVideo_ETL(self,**params):
 | 
											
												
													
														|  | 
 |  | +        today = datetime.today()
 | 
											
												
													
														|  | 
 |  | +        if params.get("date")==None:
 | 
											
												
													
														|  | 
 |  | +            params["date"] = (datetime(today.year,today.month,today.day,tzinfo=timezone.utc)-timedelta(days=1)).strftime("%Y%m%d")
 | 
											
												
													
														|  | 
 |  | +        params['record_type']='ads'
 | 
											
												
													
														|  | 
 |  | +        if params.get('metrics')==None:
 | 
											
												
													
														|  | 
 |  | +            params['metrics'] = [
 | 
											
												
													
														|  | 
 |  | +                'adGroupId', 'adGroupName', 'adId', 'applicableBudgetRuleId', 'applicableBudgetRuleName',
 | 
											
												
													
														|  | 
 |  | +                'attributedConversions14d', 'attributedConversions14dSameSKU', 'attributedDetailPageViewsClicks14d',
 | 
											
												
													
														|  | 
 |  | +                'attributedOrderRateNewToBrand14d', 'attributedOrdersNewToBrand14d',
 | 
											
												
													
														|  | 
 |  | +                'attributedOrdersNewToBrandPercentage14d', 'attributedSales14d', 'attributedSales14dSameSKU',
 | 
											
												
													
														|  | 
 |  | +                'attributedSalesNewToBrand14d', 'attributedSalesNewToBrandPercentage14d',
 | 
											
												
													
														|  | 
 |  | +                'attributedUnitsOrderedNewToBrand14d', 'attributedUnitsOrderedNewToBrandPercentage14d', 'campaignBudget',
 | 
											
												
													
														|  | 
 |  | +                'campaignBudgetType', 'campaignId', 'campaignName', 'campaignRuleBasedBudget', 'campaignStatus', 'clicks', 'cost',
 | 
											
												
													
														|  | 
 |  | +                'dpv14d', 'impressions', 'vctr', 'video5SecondViewRate', 'video5SecondViews', 'videoCompleteViews',
 | 
											
												
													
														|  | 
 |  | +                'videoFirstQuartileViews', 'videoMidpointViews', 'videoThirdQuartileViews', 'videoUnmutes', 'viewableImpressions',
 | 
											
												
													
														|  | 
 |  | +                'vtr', 'attributedBrandedSearches14d', 'currency'
 | 
											
												
													
														|  | 
 |  | +                ] #
 | 
											
												
													
														|  | 
 |  | +        # print(date)
 | 
											
												
													
														|  | 
 |  | +        list_report = self.get_v2_report(record_type=params['record_type'],report_date=params["date"],metrics=params['metrics'],creative_type='video')
 | 
											
												
													
														|  | 
 |  | +        # print(list_report)
 | 
											
												
													
														|  | 
 |  | +        df_report = pd.json_normalize(list_report)
 | 
											
												
													
														|  | 
 |  | +        return df_report
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |  class SD_ETL(SDClient,Common_ETLMethod):
 |  |  class SD_ETL(SDClient,Common_ETLMethod):
 | 
											
												
													
														|  |      def campaigns_ETL(self):
 |  |      def campaigns_ETL(self):
 | 
											
												
													
														|  |          list_campaign_SD = self.get_campaigns()
 |  |          list_campaign_SD = self.get_campaigns()
 | 
											
										
											
												
													
														|  | @@ -669,6 +1018,8 @@ if __name__ == '__main__':
 | 
											
												
													
														|  |          'lwa_client_secret': 'cbf0514186db4df91e04a8905f0a91b605eae4201254ced879d8bb90df4b474d',
 |  |          'lwa_client_secret': 'cbf0514186db4df91e04a8905f0a91b605eae4201254ced879d8bb90df4b474d',
 | 
											
												
													
														|  |          'profile_id': "3006125408623189"
 |  |          'profile_id': "3006125408623189"
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  | -    ac_etl = SD_ETL(**AWS_CREDENTIALS)
 |  | 
 | 
											
												
													
														|  | 
 |  | +    ac_etl = SP_ETL(**AWS_CREDENTIALS)
 | 
											
												
													
														|  |      # print(ac_etl.budget_ETL(campaign_ids=["126327624499318"]))
 |  |      # print(ac_etl.budget_ETL(campaign_ids=["126327624499318"]))
 | 
											
												
													
														|  | -    print(ac_etl.reportV2_targets_matchedTarget_t2_ETL(**{}))
 |  | 
 | 
											
												
													
														|  | 
 |  | +    print(ac_etl.reportV3_advertiserRecord_ETL(**{}))
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +    ####
 |