浏览代码

expression_split modify

huangyifan 1 年之前
父节点
当前提交
55115c25fb
共有 1 个文件被更改,包括 6 次插入4 次删除
  1. 6 4
      sync_amz_data/DataTransform/Data_ETL.py

+ 6 - 4
sync_amz_data/DataTransform/Data_ETL.py

@@ -67,9 +67,9 @@ class Common_ETLMethod(BaseClient):
         """
         df[segment] = df[segment].astype("string")
         df[segment + str("_type")] = df[segment].str.extract(r"'type':\s{0,1}'(.+?)',")
-        df[segment + str("_value")] = df[segment].str.extract(r"'value':\s{0,1}[',[,{](.+)'")
+        df[segment + str("_value")] = df[segment].str.extract(r"'value':\s{0,1}[\'\[\{](.+)'")
         df[segment + str("_value")] = df[segment + str("_value")].map(
-            lambda x: x if pd.isna(x) or "," not in x else "[" + x + "'}]")
+            lambda x: x if pd.isna(x) or "," not in x else "[{" + x + "'}]")
         df.replace(['nan', 'Nan', 'NaN'], np.nan, inplace=True)
         df.drop(columns=[segment], inplace=True)
         return df
@@ -1436,10 +1436,12 @@ if __name__ == '__main__':
         'lwa_client_secret': 'cbf0514186db4df91e04a8905f0a91b605eae4201254ced879d8bb90df4b474d',
         'profile_id': "3006125408623189"
     }
-    conn = Common_ETLMethod.clickhouse_connect()
+    conn = Common_ETLMethod(**AWS_CREDENTIALS).clickhouse_connect()
 
     # SD
-    # ac_etl = SD_ETL(**AWS_CREDENTIALS)
+    ac_etl = SD_ETL(**AWS_CREDENTIALS)
+    ls = ac_etl.targets_ETL()
+    print(ls)
     # ac_etl.reportV2_campaignsRecord_t2_ETL(conn)
     # ac_etl.reportV2_campaignsRecord_t3_ETL(conn)
     # ac_etl.reportV2_adGroupsRecord_t2_ETL(conn)