|
@@ -3,7 +3,7 @@ from sync_amz_data.public.amz_ad_client import SPClient, Account, SBClient, SDCl
|
|
import pandas as pd
|
|
import pandas as pd
|
|
import numpy as np
|
|
import numpy as np
|
|
from dateutil.parser import parse
|
|
from dateutil.parser import parse
|
|
-
|
|
|
|
|
|
+import time
|
|
pd.set_option('display.max_columns', None)
|
|
pd.set_option('display.max_columns', None)
|
|
import warnings
|
|
import warnings
|
|
|
|
|
|
@@ -117,8 +117,26 @@ class Common_ETLMethod(BaseClient):
|
|
# df_report[df_report.select_dtypes('O').columns] = df_report[df_report.select_dtypes('O').columns].astype('string')
|
|
# df_report[df_report.select_dtypes('O').columns] = df_report[df_report.select_dtypes('O').columns].astype('string')
|
|
toFloat = [i for i in columns if 'sales' in i.lower() or 'percent' in i.lower() or 'video' in i.lower()]
|
|
toFloat = [i for i in columns if 'sales' in i.lower() or 'percent' in i.lower() or 'video' in i.lower()]
|
|
if len(toFloat) > 0:
|
|
if len(toFloat) > 0:
|
|
- df_report[toFloat] = df_report[toFloat].applymap(lambda x: np.nan if pd.isna(x) or x == '' else float(x))
|
|
|
|
-
|
|
|
|
|
|
+ df_report[toFloat] = df_report[toFloat].applymap(lambda x: 0.0 if pd.isna(x) or x == '' else float(x))
|
|
|
|
+
|
|
|
|
+ df_report[df_report.select_dtypes(["int"]).columns] = df_report[df_report.select_dtypes(["int"]).columns].fillna(0)
|
|
|
|
+ df_report[df_report.select_dtypes(["float"]).columns] = df_report[df_report.select_dtypes(["float"]).columns].fillna(0.0)
|
|
|
|
+ if "campaignRuleBasedBudget" in df_report.columns:
|
|
|
|
+ df_report["campaignRuleBasedBudget"] = df_report["campaignRuleBasedBudget"].fillna(0.0)
|
|
|
|
+ if "campaignRuleBasedBudgetAmount" in df_report.columns:
|
|
|
|
+ df_report["campaignRuleBasedBudgetAmount"] = df_report["campaignRuleBasedBudgetAmount"].fillna(0.0)
|
|
|
|
+ if "eCPAddToCart" in df_report.columns:
|
|
|
|
+ df_report["eCPAddToCart"] = df_report["eCPAddToCart"].fillna(0.0)
|
|
|
|
+ if "eCPBrandSearch" in df_report.columns:
|
|
|
|
+ df_report["eCPBrandSearch"] =df_report["eCPBrandSearch"].fillna(0.0)
|
|
|
|
+ if "viewClickThroughRate" in df_report.columns:
|
|
|
|
+ df_report["viewClickThroughRate"] = df_report["viewClickThroughRate"].fillna(0.0)
|
|
|
|
+ if "searchTermImpressionRank" in df_report.columns:
|
|
|
|
+ df_report["searchTermImpressionRank"] = df_report["searchTermImpressionRank"].fillna(0)
|
|
|
|
+ if "searchTermImpressionShare" in df_report.columns:
|
|
|
|
+ df_report["searchTermImpressionShare"] = df_report["searchTermImpressionShare"].fillna(0.0)
|
|
|
|
+ if "impressionsFrequencyAverage" in df_report.columns:
|
|
|
|
+ df_report["impressionsFrequencyAverage"] = df_report["impressionsFrequencyAverage"].fillna(0.0)
|
|
df_report.fillna(np.nan, inplace=True)
|
|
df_report.fillna(np.nan, inplace=True)
|
|
# print(df_report[columns].info())
|
|
# print(df_report[columns].info())
|
|
# df_report.to_excel("df.xlsx")
|
|
# df_report.to_excel("df.xlsx")
|
|
@@ -236,6 +254,7 @@ class SP_ETL(SPClient, Common_ETLMethod):
|
|
df_report = self.type_trans(df_report, params['columns'], timeZone_, extra_columns=[])
|
|
df_report = self.type_trans(df_report, params['columns'], timeZone_, extra_columns=[])
|
|
|
|
|
|
conn.insert_df("AmazonReport.SP_spCampaigns_campaignV3", df_report[params['columns']])
|
|
conn.insert_df("AmazonReport.SP_spCampaigns_campaignV3", df_report[params['columns']])
|
|
|
|
+ time.sleep(0.05)
|
|
print("插入完成SP_spCampaigns_campaignV3")
|
|
print("插入完成SP_spCampaigns_campaignV3")
|
|
|
|
|
|
df_rel = df_report[params['columns']]
|
|
df_rel = df_report[params['columns']]
|
|
@@ -271,6 +290,7 @@ class SP_ETL(SPClient, Common_ETLMethod):
|
|
df_report = self.type_trans(df_report, params['columns'], timeZone_, extra_columns=[])
|
|
df_report = self.type_trans(df_report, params['columns'], timeZone_, extra_columns=[])
|
|
|
|
|
|
conn.insert_df("AmazonReport.SP_spCampaigns_adGroupV3", df_report[params['columns']])
|
|
conn.insert_df("AmazonReport.SP_spCampaigns_adGroupV3", df_report[params['columns']])
|
|
|
|
+ time.sleep(0.05)
|
|
print("插入完成SP_spCampaigns_adGroupV3")
|
|
print("插入完成SP_spCampaigns_adGroupV3")
|
|
|
|
|
|
df_rel = df_report[params['columns']]
|
|
df_rel = df_report[params['columns']]
|
|
@@ -308,6 +328,7 @@ class SP_ETL(SPClient, Common_ETLMethod):
|
|
df_report = self.type_trans(df_report, params['columns'], timeZone_, extra_columns=[])
|
|
df_report = self.type_trans(df_report, params['columns'], timeZone_, extra_columns=[])
|
|
|
|
|
|
conn.insert_df("AmazonReport.SP_spCampaigns_placementV3", df_report[params['columns']])
|
|
conn.insert_df("AmazonReport.SP_spCampaigns_placementV3", df_report[params['columns']])
|
|
|
|
+ time.sleep(0.05)
|
|
print("插入完成SP_spCampaigns_placementV3")
|
|
print("插入完成SP_spCampaigns_placementV3")
|
|
|
|
|
|
|
|
|
|
@@ -346,6 +367,7 @@ class SP_ETL(SPClient, Common_ETLMethod):
|
|
df_report = self.type_trans(df_report, params['columns'], timeZone_, extra_columns=[])
|
|
df_report = self.type_trans(df_report, params['columns'], timeZone_, extra_columns=[])
|
|
|
|
|
|
conn.insert_df("AmazonReport.SP_spTargeting_targetingV3", df_report[params['columns']])
|
|
conn.insert_df("AmazonReport.SP_spTargeting_targetingV3", df_report[params['columns']])
|
|
|
|
+ time.sleep(0.05)
|
|
print("插入完成SP_spTargeting_targetingV3")
|
|
print("插入完成SP_spTargeting_targetingV3")
|
|
|
|
|
|
|
|
|
|
@@ -384,6 +406,7 @@ class SP_ETL(SPClient, Common_ETLMethod):
|
|
df_report = self.type_trans(df_report, params['columns'], timeZone_, extra_columns=[])
|
|
df_report = self.type_trans(df_report, params['columns'], timeZone_, extra_columns=[])
|
|
|
|
|
|
conn.insert_df("AmazonReport.SP_spSearchTerm_searchTermV3", df_report[params['columns']])
|
|
conn.insert_df("AmazonReport.SP_spSearchTerm_searchTermV3", df_report[params['columns']])
|
|
|
|
+ time.sleep(0.05)
|
|
print("插入完成SP_spSearchTerm_searchTermV3")
|
|
print("插入完成SP_spSearchTerm_searchTermV3")
|
|
|
|
|
|
|
|
|
|
@@ -419,6 +442,7 @@ class SP_ETL(SPClient, Common_ETLMethod):
|
|
df_report = self.type_trans(df_report, params['columns'], timeZone_, extra_columns=[])
|
|
df_report = self.type_trans(df_report, params['columns'], timeZone_, extra_columns=[])
|
|
# print(df_report.info())
|
|
# print(df_report.info())
|
|
conn.insert_df("AmazonReport.SP_spAdvertisedProduct_advertiserV3", df_report[params['columns']])
|
|
conn.insert_df("AmazonReport.SP_spAdvertisedProduct_advertiserV3", df_report[params['columns']])
|
|
|
|
+ time.sleep(0.05)
|
|
print("插入完成SP_spAdvertisedProduct_advertiserV3")
|
|
print("插入完成SP_spAdvertisedProduct_advertiserV3")
|
|
|
|
|
|
|
|
|
|
@@ -452,6 +476,7 @@ class SP_ETL(SPClient, Common_ETLMethod):
|
|
df_report = self.type_trans(df_report, params['columns'], timeZone_, extra_columns=[])
|
|
df_report = self.type_trans(df_report, params['columns'], timeZone_, extra_columns=[])
|
|
|
|
|
|
conn.insert_df("AmazonReport.SP_spPurchasedProduct_asinV3", df_report[params['columns']])
|
|
conn.insert_df("AmazonReport.SP_spPurchasedProduct_asinV3", df_report[params['columns']])
|
|
|
|
+ time.sleep(0.05)
|
|
print("插入完成SP_spPurchasedProduct_asinV3")
|
|
print("插入完成SP_spPurchasedProduct_asinV3")
|
|
|
|
|
|
|
|
|
|
@@ -533,6 +558,7 @@ class SB_ETL(SBClient, Common_ETLMethod):
|
|
|
|
|
|
# print(df_report)
|
|
# print(df_report)
|
|
# conn.insert_df("AmazonReport.SB_sbPurchasedProduct_asinV3", df_report[params['columns']])
|
|
# conn.insert_df("AmazonReport.SB_sbPurchasedProduct_asinV3", df_report[params['columns']])
|
|
|
|
+ # time.sleep(0.05)
|
|
# print("插入完成SB_sbPurchasedProduct_asinV3")
|
|
# print("插入完成SB_sbPurchasedProduct_asinV3")
|
|
|
|
|
|
|
|
|
|
@@ -563,6 +589,7 @@ class SB_ETL(SBClient, Common_ETLMethod):
|
|
|
|
|
|
# print(df_report)
|
|
# print(df_report)
|
|
conn.insert_df("AmazonReport.SB_sbPurchasedProduct_asinV3", df_report[params['columns']])
|
|
conn.insert_df("AmazonReport.SB_sbPurchasedProduct_asinV3", df_report[params['columns']])
|
|
|
|
+ time.sleep(0.05)
|
|
print("插入完成SB_sbPurchasedProduct_asinV3")
|
|
print("插入完成SB_sbPurchasedProduct_asinV3")
|
|
|
|
|
|
|
|
|
|
@@ -596,6 +623,7 @@ class SB_ETL(SBClient, Common_ETLMethod):
|
|
df_report = self.type_trans(df_report, metric, timeZone_, extra_columns=[])
|
|
df_report = self.type_trans(df_report, metric, timeZone_, extra_columns=[])
|
|
|
|
|
|
conn.insert_df("AmazonReport.SB_campaignsV2", df_report[metric])
|
|
conn.insert_df("AmazonReport.SB_campaignsV2", df_report[metric])
|
|
|
|
+ time.sleep(0.05)
|
|
print("插入完成SB_campaignsV2")
|
|
print("插入完成SB_campaignsV2")
|
|
|
|
|
|
|
|
|
|
@@ -630,6 +658,7 @@ class SB_ETL(SBClient, Common_ETLMethod):
|
|
df_report = self.type_trans(df_report, metric, timeZone_, extra_columns=[])
|
|
df_report = self.type_trans(df_report, metric, timeZone_, extra_columns=[])
|
|
|
|
|
|
conn.insert_df("AmazonReport.SB_campaignsVideoV2", df_report[metric])
|
|
conn.insert_df("AmazonReport.SB_campaignsVideoV2", df_report[metric])
|
|
|
|
+ time.sleep(0.05)
|
|
print("插入完成SB_campaignsVideoV2")
|
|
print("插入完成SB_campaignsVideoV2")
|
|
# print(df_report[metric].info())
|
|
# print(df_report[metric].info())
|
|
|
|
|
|
@@ -660,6 +689,7 @@ class SB_ETL(SBClient, Common_ETLMethod):
|
|
df_report = self.type_trans(df_report, metric, timeZone_, extra_columns=['placement'])
|
|
df_report = self.type_trans(df_report, metric, timeZone_, extra_columns=['placement'])
|
|
|
|
|
|
conn.insert_df("AmazonReport.SB_campaignsPlacementV2", df_report[metric])
|
|
conn.insert_df("AmazonReport.SB_campaignsPlacementV2", df_report[metric])
|
|
|
|
+ time.sleep(0.05)
|
|
print("插入完成SB_campaignsPlacementV2")
|
|
print("插入完成SB_campaignsPlacementV2")
|
|
# print(df_report[metric].info())
|
|
# print(df_report[metric].info())
|
|
|
|
|
|
@@ -692,6 +722,7 @@ class SB_ETL(SBClient, Common_ETLMethod):
|
|
# print(df_report.info())
|
|
# print(df_report.info())
|
|
|
|
|
|
conn.insert_df("AmazonReport.SB_campaignsPlacementVideoV2", df_report[metric])
|
|
conn.insert_df("AmazonReport.SB_campaignsPlacementVideoV2", df_report[metric])
|
|
|
|
+ time.sleep(0.05)
|
|
print("插入完成SB_campaignsPlacementVideoV2")
|
|
print("插入完成SB_campaignsPlacementVideoV2")
|
|
|
|
|
|
|
|
|
|
@@ -723,6 +754,7 @@ class SB_ETL(SBClient, Common_ETLMethod):
|
|
# print(df_report.info())
|
|
# print(df_report.info())
|
|
|
|
|
|
conn.insert_df("AmazonReport.SB_adGroupsV2", df_report[metric])
|
|
conn.insert_df("AmazonReport.SB_adGroupsV2", df_report[metric])
|
|
|
|
+ time.sleep(0.05)
|
|
print("插入完成SB_adGroupsV2")
|
|
print("插入完成SB_adGroupsV2")
|
|
|
|
|
|
|
|
|
|
@@ -755,6 +787,7 @@ class SB_ETL(SBClient, Common_ETLMethod):
|
|
# print(df_report.info())
|
|
# print(df_report.info())
|
|
|
|
|
|
conn.insert_df("AmazonReport.SB_adGroupsVideoV2", df_report[metric])
|
|
conn.insert_df("AmazonReport.SB_adGroupsVideoV2", df_report[metric])
|
|
|
|
+ time.sleep(0.05)
|
|
print("插入完成SB_adGroupsVideoV2")
|
|
print("插入完成SB_adGroupsVideoV2")
|
|
|
|
|
|
df_rel = df_report[metric]
|
|
df_rel = df_report[metric]
|
|
@@ -785,6 +818,7 @@ class SB_ETL(SBClient, Common_ETLMethod):
|
|
# print(df_report.info())
|
|
# print(df_report.info())
|
|
|
|
|
|
conn.insert_df("AmazonReport.SB_targetsV2", df_report[metric])
|
|
conn.insert_df("AmazonReport.SB_targetsV2", df_report[metric])
|
|
|
|
+ time.sleep(0.05)
|
|
print("插入完成SB_targetsV2")
|
|
print("插入完成SB_targetsV2")
|
|
|
|
|
|
|
|
|
|
@@ -818,6 +852,7 @@ class SB_ETL(SBClient, Common_ETLMethod):
|
|
# print(df_report.info())
|
|
# print(df_report.info())
|
|
|
|
|
|
conn.insert_df("AmazonReport.SB_targetsVideoV2", df_report[metric])
|
|
conn.insert_df("AmazonReport.SB_targetsVideoV2", df_report[metric])
|
|
|
|
+ time.sleep(0.05)
|
|
print("插入完成SB_targetsVideoV2")
|
|
print("插入完成SB_targetsVideoV2")
|
|
|
|
|
|
df_rel = df_report[metric]
|
|
df_rel = df_report[metric]
|
|
@@ -849,6 +884,7 @@ class SB_ETL(SBClient, Common_ETLMethod):
|
|
# print(df_report.info())
|
|
# print(df_report.info())
|
|
|
|
|
|
conn.insert_df("AmazonReport.SB_keywordsV2", df_report[metric])
|
|
conn.insert_df("AmazonReport.SB_keywordsV2", df_report[metric])
|
|
|
|
+ time.sleep(0.05)
|
|
print("插入完成SB_keywordsV2")
|
|
print("插入完成SB_keywordsV2")
|
|
|
|
|
|
df_rel = df_report[metric]
|
|
df_rel = df_report[metric]
|
|
@@ -881,6 +917,7 @@ class SB_ETL(SBClient, Common_ETLMethod):
|
|
# print(df_report.info())
|
|
# print(df_report.info())
|
|
|
|
|
|
conn.insert_df("AmazonReport.SB_keywordsVideoV2", df_report[metric])
|
|
conn.insert_df("AmazonReport.SB_keywordsVideoV2", df_report[metric])
|
|
|
|
+ time.sleep(0.05)
|
|
print("插入完成SB_keywordsVideoV2")
|
|
print("插入完成SB_keywordsVideoV2")
|
|
|
|
|
|
df_rel = df_report[metric]
|
|
df_rel = df_report[metric]
|
|
@@ -907,6 +944,7 @@ class SB_ETL(SBClient, Common_ETLMethod):
|
|
# print(df_report.info())
|
|
# print(df_report.info())
|
|
|
|
|
|
conn.insert_df("AmazonReport.SB_keywordsQueryV2", df_report[metric])
|
|
conn.insert_df("AmazonReport.SB_keywordsQueryV2", df_report[metric])
|
|
|
|
+ time.sleep(0.05)
|
|
print("插入完成SB_keywordsQueryV2")
|
|
print("插入完成SB_keywordsQueryV2")
|
|
|
|
|
|
df_rel = df_report[metric]
|
|
df_rel = df_report[metric]
|
|
@@ -936,6 +974,7 @@ class SB_ETL(SBClient, Common_ETLMethod):
|
|
# print(df_report.info())
|
|
# print(df_report.info())
|
|
|
|
|
|
conn.insert_df("AmazonReport.SB_keywordsQueryVideoV2", df_report[metric])
|
|
conn.insert_df("AmazonReport.SB_keywordsQueryVideoV2", df_report[metric])
|
|
|
|
+ time.sleep(0.05)
|
|
print("插入完成SB_keywordsQueryVideoV2")
|
|
print("插入完成SB_keywordsQueryVideoV2")
|
|
|
|
|
|
df_rel = df_report[metric]
|
|
df_rel = df_report[metric]
|
|
@@ -965,6 +1004,7 @@ class SB_ETL(SBClient, Common_ETLMethod):
|
|
df_report = self.type_trans(df_report, metric, timeZone_, extra_columns=[])
|
|
df_report = self.type_trans(df_report, metric, timeZone_, extra_columns=[])
|
|
|
|
|
|
conn.insert_df("AmazonReport.SB_adsV2", df_report[metric])
|
|
conn.insert_df("AmazonReport.SB_adsV2", df_report[metric])
|
|
|
|
+ time.sleep(0.05)
|
|
print("插入完成SB_adsV2")
|
|
print("插入完成SB_adsV2")
|
|
|
|
|
|
df_rel = df_report[metric]
|
|
df_rel = df_report[metric]
|
|
@@ -998,6 +1038,7 @@ class SB_ETL(SBClient, Common_ETLMethod):
|
|
# print(df_report.info())
|
|
# print(df_report.info())
|
|
|
|
|
|
conn.insert_df("AmazonReport.SB_adsVideoV2", df_report[metric])
|
|
conn.insert_df("AmazonReport.SB_adsVideoV2", df_report[metric])
|
|
|
|
+ time.sleep(0.05)
|
|
print("插入完成SB_adsVideoV2")
|
|
print("插入完成SB_adsVideoV2")
|
|
|
|
|
|
df_rel = df_report[metric]
|
|
df_rel = df_report[metric]
|
|
@@ -1068,6 +1109,7 @@ class SD_ETL(SDClient, Common_ETLMethod):
|
|
|
|
|
|
# print(df_report.columns)
|
|
# print(df_report.columns)
|
|
conn.insert_df("AmazonReport.SD_sdCampaigns_campaignV3", df_report[params['columns']])
|
|
conn.insert_df("AmazonReport.SD_sdCampaigns_campaignV3", df_report[params['columns']])
|
|
|
|
+ time.sleep(0.05)
|
|
print("插入完成SD_sdCampaigns_campaignV3")
|
|
print("插入完成SD_sdCampaigns_campaignV3")
|
|
|
|
|
|
|
|
|
|
@@ -1102,6 +1144,7 @@ class SD_ETL(SDClient, Common_ETLMethod):
|
|
|
|
|
|
# print(df_report.columns)
|
|
# print(df_report.columns)
|
|
conn.insert_df("AmazonReport.SD_sdCampaigns_campaignMatchedTargetV3", df_report[params['columns']])
|
|
conn.insert_df("AmazonReport.SD_sdCampaigns_campaignMatchedTargetV3", df_report[params['columns']])
|
|
|
|
+ time.sleep(0.05)
|
|
print("插入完成SD_sdCampaigns_campaignMatchedTargetV3")
|
|
print("插入完成SD_sdCampaigns_campaignMatchedTargetV3")
|
|
|
|
|
|
|
|
|
|
@@ -1137,6 +1180,7 @@ class SD_ETL(SDClient, Common_ETLMethod):
|
|
|
|
|
|
# print(df_report)
|
|
# print(df_report)
|
|
conn.insert_df("AmazonReport.SD_sdAdGroup_adGroupV3", df_report[params['columns']])
|
|
conn.insert_df("AmazonReport.SD_sdAdGroup_adGroupV3", df_report[params['columns']])
|
|
|
|
+ time.sleep(0.05)
|
|
print("插入完成SD_sdAdGroup_adGroupV3")
|
|
print("插入完成SD_sdAdGroup_adGroupV3")
|
|
|
|
|
|
|
|
|
|
@@ -1172,6 +1216,7 @@ class SD_ETL(SDClient, Common_ETLMethod):
|
|
|
|
|
|
# print(df_report)
|
|
# print(df_report)
|
|
conn.insert_df("AmazonReport.SD_sdAdGroup_adGroupMatchedTargetV3", df_report[params['columns']])
|
|
conn.insert_df("AmazonReport.SD_sdAdGroup_adGroupMatchedTargetV3", df_report[params['columns']])
|
|
|
|
+ time.sleep(0.05)
|
|
print("插入完成SD_sdAdGroup_adGroupMatchedTargetV3")
|
|
print("插入完成SD_sdAdGroup_adGroupMatchedTargetV3")
|
|
|
|
|
|
|
|
|
|
@@ -1211,6 +1256,7 @@ class SD_ETL(SDClient, Common_ETLMethod):
|
|
|
|
|
|
# print(df_report)
|
|
# print(df_report)
|
|
conn.insert_df("AmazonReport.SD_targeting_sdTargetingV3", df_report[params['columns']])
|
|
conn.insert_df("AmazonReport.SD_targeting_sdTargetingV3", df_report[params['columns']])
|
|
|
|
+ time.sleep(0.05)
|
|
print("插入完成SD_targeting_sdTargetingV3")
|
|
print("插入完成SD_targeting_sdTargetingV3")
|
|
|
|
|
|
|
|
|
|
@@ -1251,6 +1297,7 @@ class SD_ETL(SDClient, Common_ETLMethod):
|
|
|
|
|
|
# print(df_report)
|
|
# print(df_report)
|
|
conn.insert_df("AmazonReport.SD_targeting_sdTargetingMatchedTargetV3", df_report[params['columns']])
|
|
conn.insert_df("AmazonReport.SD_targeting_sdTargetingMatchedTargetV3", df_report[params['columns']])
|
|
|
|
+ time.sleep(0.05)
|
|
print("插入完成SD_targeting_sdTargetingMatchedTargetV3")
|
|
print("插入完成SD_targeting_sdTargetingMatchedTargetV3")
|
|
|
|
|
|
|
|
|
|
@@ -1288,6 +1335,7 @@ class SD_ETL(SDClient, Common_ETLMethod):
|
|
|
|
|
|
# print(df_report)
|
|
# print(df_report)
|
|
conn.insert_df("AmazonReport.SD_advertiser_sdAdvertisedProductV3", df_report[params['columns']])
|
|
conn.insert_df("AmazonReport.SD_advertiser_sdAdvertisedProductV3", df_report[params['columns']])
|
|
|
|
+ time.sleep(0.05)
|
|
print("插入完成SD_advertiser_sdAdvertisedProductV3")
|
|
print("插入完成SD_advertiser_sdAdvertisedProductV3")
|
|
|
|
|
|
|
|
|
|
@@ -1317,6 +1365,7 @@ class SD_ETL(SDClient, Common_ETLMethod):
|
|
|
|
|
|
# print(df_report)
|
|
# print(df_report)
|
|
conn.insert_df("AmazonReport.SD_asin_sdPurchasedProductV3", df_report[params['columns']])
|
|
conn.insert_df("AmazonReport.SD_asin_sdPurchasedProductV3", df_report[params['columns']])
|
|
|
|
+ time.sleep(0.05)
|
|
print("插入完成SD_asin_sdPurchasedProductV3")
|
|
print("插入完成SD_asin_sdPurchasedProductV3")
|
|
|
|
|
|
|
|
|
|
@@ -1357,6 +1406,7 @@ class SD_ETL(SDClient, Common_ETLMethod):
|
|
df_report = self.type_trans(df_report, metric, timeZone_, extra_columns=['tactic'])
|
|
df_report = self.type_trans(df_report, metric, timeZone_, extra_columns=['tactic'])
|
|
|
|
|
|
conn.insert_df("AmazonReport.SD_campaignsV2", df_report[metric])
|
|
conn.insert_df("AmazonReport.SD_campaignsV2", df_report[metric])
|
|
|
|
+ time.sleep(0.05)
|
|
print("插入完成SD_campaignsV2—")
|
|
print("插入完成SD_campaignsV2—")
|
|
|
|
|
|
df_rel = df_report[metric]
|
|
df_rel = df_report[metric]
|
|
@@ -1380,6 +1430,7 @@ class SD_ETL(SDClient, Common_ETLMethod):
|
|
df_report = self.type_trans(df_report, metric, timeZone_, extra_columns=['tactic'])
|
|
df_report = self.type_trans(df_report, metric, timeZone_, extra_columns=['tactic'])
|
|
|
|
|
|
conn.insert_df("AmazonReport.SD_campaignsV2", df_report[metric])
|
|
conn.insert_df("AmazonReport.SD_campaignsV2", df_report[metric])
|
|
|
|
+ time.sleep(0.05)
|
|
print("插入完成SD_campaignsV2")
|
|
print("插入完成SD_campaignsV2")
|
|
|
|
|
|
df_rel = df_report[metric]
|
|
df_rel = df_report[metric]
|
|
@@ -1416,6 +1467,7 @@ class SD_ETL(SDClient, Common_ETLMethod):
|
|
df_report = self.type_trans(df_report, metric, timeZone_, extra_columns=['tactic'])
|
|
df_report = self.type_trans(df_report, metric, timeZone_, extra_columns=['tactic'])
|
|
|
|
|
|
conn.insert_df("AmazonReport.SD_adGroupsV2", df_report[metric])
|
|
conn.insert_df("AmazonReport.SD_adGroupsV2", df_report[metric])
|
|
|
|
+ time.sleep(0.05)
|
|
print("插入完成SD_adGroupsV2")
|
|
print("插入完成SD_adGroupsV2")
|
|
|
|
|
|
df_rel = df_report[metric]
|
|
df_rel = df_report[metric]
|
|
@@ -1437,6 +1489,7 @@ class SD_ETL(SDClient, Common_ETLMethod):
|
|
# print(df_report.info())
|
|
# print(df_report.info())
|
|
|
|
|
|
conn.insert_df("AmazonReport.SD_adGroupsV2", df_report[metric])
|
|
conn.insert_df("AmazonReport.SD_adGroupsV2", df_report[metric])
|
|
|
|
+ time.sleep(0.05)
|
|
print("插入完成SD_adGroupsV2")
|
|
print("插入完成SD_adGroupsV2")
|
|
|
|
|
|
df_rel = df_report[metric]
|
|
df_rel = df_report[metric]
|
|
@@ -1473,6 +1526,7 @@ class SD_ETL(SDClient, Common_ETLMethod):
|
|
df_report = self.type_trans(df_report, metric, timeZone_, extra_columns=['tactic'])
|
|
df_report = self.type_trans(df_report, metric, timeZone_, extra_columns=['tactic'])
|
|
|
|
|
|
conn.insert_df("AmazonReport.SD_adsV2", df_report[metric])
|
|
conn.insert_df("AmazonReport.SD_adsV2", df_report[metric])
|
|
|
|
+ time.sleep(0.05)
|
|
print("插入完成SD_adsV2")
|
|
print("插入完成SD_adsV2")
|
|
|
|
|
|
df_rel = df_report[metric]
|
|
df_rel = df_report[metric]
|
|
@@ -1495,6 +1549,7 @@ class SD_ETL(SDClient, Common_ETLMethod):
|
|
# print(df_report.info())
|
|
# print(df_report.info())
|
|
|
|
|
|
conn.insert_df("AmazonReport.SD_adsV2", df_report[metric])
|
|
conn.insert_df("AmazonReport.SD_adsV2", df_report[metric])
|
|
|
|
+ time.sleep(0.05)
|
|
print("插入完成SD_adsV2")
|
|
print("插入完成SD_adsV2")
|
|
|
|
|
|
df_rel = df_report[metric]
|
|
df_rel = df_report[metric]
|
|
@@ -1531,6 +1586,7 @@ class SD_ETL(SDClient, Common_ETLMethod):
|
|
df_report = self.type_trans(df_report, metric, timeZone_, extra_columns=['tactic'])
|
|
df_report = self.type_trans(df_report, metric, timeZone_, extra_columns=['tactic'])
|
|
# print(df_report[metric].info())
|
|
# print(df_report[metric].info())
|
|
conn.insert_df("AmazonReport.SD_targetsV2", df_report[metric])
|
|
conn.insert_df("AmazonReport.SD_targetsV2", df_report[metric])
|
|
|
|
+ time.sleep(0.05)
|
|
print("插入完成SD_targetsV2")
|
|
print("插入完成SD_targetsV2")
|
|
|
|
|
|
df_rel = df_report[metric]
|
|
df_rel = df_report[metric]
|
|
@@ -1553,6 +1609,7 @@ class SD_ETL(SDClient, Common_ETLMethod):
|
|
# print(df_report.info())
|
|
# print(df_report.info())
|
|
|
|
|
|
conn.insert_df("AmazonReport.SD_targetsV2", df_report[metric])
|
|
conn.insert_df("AmazonReport.SD_targetsV2", df_report[metric])
|
|
|
|
+ time.sleep(0.05)
|
|
print("插入完成SD_targetsV2")
|
|
print("插入完成SD_targetsV2")
|
|
|
|
|
|
df_rel = df_report[metric]
|
|
df_rel = df_report[metric]
|
|
@@ -1586,6 +1643,7 @@ class SD_ETL(SDClient, Common_ETLMethod):
|
|
df_report = self.type_trans(df_report, metric, timeZone_, extra_columns=['tactic'])
|
|
df_report = self.type_trans(df_report, metric, timeZone_, extra_columns=['tactic'])
|
|
# print(df_report.info())
|
|
# print(df_report.info())
|
|
conn.insert_df("AmazonReport.SD_asinsV2", df_report[metric])
|
|
conn.insert_df("AmazonReport.SD_asinsV2", df_report[metric])
|
|
|
|
+ time.sleep(0.05)
|
|
print("插入完成SD_asinsV2")
|
|
print("插入完成SD_asinsV2")
|
|
|
|
|
|
df_rel = df_report[metric]
|
|
df_rel = df_report[metric]
|
|
@@ -1607,6 +1665,7 @@ class SD_ETL(SDClient, Common_ETLMethod):
|
|
df_report = self.type_trans(df_report, metric, timeZone_, extra_columns=['tactic'])
|
|
df_report = self.type_trans(df_report, metric, timeZone_, extra_columns=['tactic'])
|
|
|
|
|
|
conn.insert_df("AmazonReport.SD_asinsV2", df_report[metric])
|
|
conn.insert_df("AmazonReport.SD_asinsV2", df_report[metric])
|
|
|
|
+ time.sleep(0.05)
|
|
print("插入完成SD_asinsV2")
|
|
print("插入完成SD_asinsV2")
|
|
|
|
|
|
df_rel = df_report[metric]
|
|
df_rel = df_report[metric]
|
|
@@ -1646,6 +1705,7 @@ class SD_ETL(SDClient, Common_ETLMethod):
|
|
df_report = self.type_trans(df_report, metric, timeZone_, extra_columns=['matchedTarget', 'tactic'])
|
|
df_report = self.type_trans(df_report, metric, timeZone_, extra_columns=['matchedTarget', 'tactic'])
|
|
|
|
|
|
conn.insert_df("AmazonReport.SD_campaignsMatchedTargetV2", df_report[metric])
|
|
conn.insert_df("AmazonReport.SD_campaignsMatchedTargetV2", df_report[metric])
|
|
|
|
+ time.sleep(0.05)
|
|
print("插入完成SD_campaignsMatchedTargetV2")
|
|
print("插入完成SD_campaignsMatchedTargetV2")
|
|
|
|
|
|
df_rel = df_report[metric]
|
|
df_rel = df_report[metric]
|
|
@@ -1668,6 +1728,7 @@ class SD_ETL(SDClient, Common_ETLMethod):
|
|
df_report = self.type_trans(df_report, metric, timeZone_, extra_columns=['matchedTarget', 'tactic'])
|
|
df_report = self.type_trans(df_report, metric, timeZone_, extra_columns=['matchedTarget', 'tactic'])
|
|
|
|
|
|
conn.insert_df("AmazonReport.SD_campaignsMatchedTargetV2", df_report[metric])
|
|
conn.insert_df("AmazonReport.SD_campaignsMatchedTargetV2", df_report[metric])
|
|
|
|
+ time.sleep(0.05)
|
|
print("插入完成SD_campaignsMatchedTargetV2")
|
|
print("插入完成SD_campaignsMatchedTargetV2")
|
|
|
|
|
|
df_rel = df_report[metric]
|
|
df_rel = df_report[metric]
|
|
@@ -1704,6 +1765,7 @@ class SD_ETL(SDClient, Common_ETLMethod):
|
|
df_report = self.type_trans(df_report, metric, timeZone_, extra_columns=['matchedTarget', 'tactic'])
|
|
df_report = self.type_trans(df_report, metric, timeZone_, extra_columns=['matchedTarget', 'tactic'])
|
|
|
|
|
|
conn.insert_df("AmazonReport.SD_adGroupsMatchedTargetV2", df_report[metric])
|
|
conn.insert_df("AmazonReport.SD_adGroupsMatchedTargetV2", df_report[metric])
|
|
|
|
+ time.sleep(0.05)
|
|
print("插入完成SD_adGroupsMatchedTargetV2")
|
|
print("插入完成SD_adGroupsMatchedTargetV2")
|
|
|
|
|
|
df_rel = df_report[metric]
|
|
df_rel = df_report[metric]
|
|
@@ -1724,6 +1786,7 @@ class SD_ETL(SDClient, Common_ETLMethod):
|
|
df_report['tactic'] = 'Audiences targeting' # {"T00020":"Contextual targeting","T00030":"Audiences targeting"}
|
|
df_report['tactic'] = 'Audiences targeting' # {"T00020":"Contextual targeting","T00030":"Audiences targeting"}
|
|
df_report = self.type_trans(df_report, metric, timeZone_, extra_columns=['matchedTarget', 'tactic'])
|
|
df_report = self.type_trans(df_report, metric, timeZone_, extra_columns=['matchedTarget', 'tactic'])
|
|
conn.insert_df("AmazonReport.SD_adGroupsMatchedTargetV2", df_report[metric])
|
|
conn.insert_df("AmazonReport.SD_adGroupsMatchedTargetV2", df_report[metric])
|
|
|
|
+ time.sleep(0.05)
|
|
print("插入完成SD_adGroupsMatchedTargetV2")
|
|
print("插入完成SD_adGroupsMatchedTargetV2")
|
|
|
|
|
|
df_rel = df_report[metric]
|
|
df_rel = df_report[metric]
|
|
@@ -1758,6 +1821,7 @@ class SD_ETL(SDClient, Common_ETLMethod):
|
|
df_report = self.type_trans(df_report, metric, timeZone_, extra_columns=['matchedTarget', 'tactic'])
|
|
df_report = self.type_trans(df_report, metric, timeZone_, extra_columns=['matchedTarget', 'tactic'])
|
|
|
|
|
|
conn.insert_df("AmazonReport.SD_targetsMatchedTargetV2", df_report[metric])
|
|
conn.insert_df("AmazonReport.SD_targetsMatchedTargetV2", df_report[metric])
|
|
|
|
+ time.sleep(0.05)
|
|
print("插入完成SD_targetsMatchedTargetV2")
|
|
print("插入完成SD_targetsMatchedTargetV2")
|
|
|
|
|
|
df_rel = df_report[metric]
|
|
df_rel = df_report[metric]
|
|
@@ -1778,6 +1842,7 @@ class SD_ETL(SDClient, Common_ETLMethod):
|
|
df_report = self.type_trans(df_report, metric, timeZone_, extra_columns=['matchedTarget', 'tactic'])
|
|
df_report = self.type_trans(df_report, metric, timeZone_, extra_columns=['matchedTarget', 'tactic'])
|
|
|
|
|
|
conn.insert_df("AmazonReport.SD_targetsMatchedTargetV2", df_report[metric])
|
|
conn.insert_df("AmazonReport.SD_targetsMatchedTargetV2", df_report[metric])
|
|
|
|
+ time.sleep(0.05)
|
|
print("插入完成SD_targetsMatchedTargetV2")
|
|
print("插入完成SD_targetsMatchedTargetV2")
|
|
|
|
|
|
df_rel = df_report[metric]
|
|
df_rel = df_report[metric]
|