Update naming for SNOWFLAKE

This commit is contained in:
Yam ZhengLim
2022-12-28 00:11:48 +08:00
parent 827499a309
commit db7c97aa57
+4 -4
View File
@@ -18,7 +18,7 @@ def list_website_operators_csv(website_id, client, path, filename):
try: try:
output_location = path + filename output_location = path + filename
list_website_operators_json = client.website.list_website_operators(website_id) list_website_operators_json = client.website.list_website_operators(website_id)
list_website_operators_df = general_function.json_normalize_to_df(list_website_operators_json, sep='-') list_website_operators_df = general_function.json_normalize_to_df(list_website_operators_json, sep='__')
# Datetime add # Datetime add
list_website_operators_df['api_called_at'] = date.today() - timedelta(days = 1) list_website_operators_df['api_called_at'] = date.today() - timedelta(days = 1)
@@ -40,7 +40,7 @@ def list_people_profiles_csv(website_id, client, path, filename):
while loop_flag == True: while loop_flag == True:
list_people_profiles_json = client.website.list_people_profiles(website_id, page_number) list_people_profiles_json = client.website.list_people_profiles(website_id, page_number)
temp_df = general_function.json_normalize_to_df(list_people_profiles_json, sep='-') temp_df = general_function.json_normalize_to_df(list_people_profiles_json, sep='__')
temp_df['api_page_number'] = page_number temp_df['api_page_number'] = page_number
list_people_profiles_df = pd.concat([temp_df,list_people_profiles_df], ignore_index=True) list_people_profiles_df = pd.concat([temp_df,list_people_profiles_df], ignore_index=True)
if not list_people_profiles_json: if not list_people_profiles_json:
@@ -82,7 +82,7 @@ def get_people_data_csv(website_id, client, path, filename, list_people_profiles
# Fix setup error by CX team, eg( exchange-marking, shipping-marking -> should be shipping_marking) # Fix setup error by CX team, eg( exchange-marking, shipping-marking -> should be shipping_marking)
get_people_data_df.columns = get_people_data_df.columns.str.replace("-", "_") get_people_data_df.columns = get_people_data_df.columns.str.replace("-", "_")
get_people_data_df.columns = get_people_data_df.columns.str.replace(".", "-") get_people_data_df.columns = get_people_data_df.columns.str.replace(".", "__")
# Datetime add # Datetime add
get_people_data_df['api_called_at'] = date.today() - timedelta(days = 1) get_people_data_df['api_called_at'] = date.today() - timedelta(days = 1)
@@ -107,7 +107,7 @@ def get_people_subscription_status_csv(website_id, client, path, filename, list_
# Get email subscription status # Get email subscription status
for people_id in person_ids: for people_id in person_ids:
pget_people_subscription_status_df_json = client.website.get_people_subscription_status(website_id, people_id) pget_people_subscription_status_df_json = client.website.get_people_subscription_status(website_id, people_id)
temp_df = general_function.json_normalize_to_df(pget_people_subscription_status_df_json, sep='-') temp_df = general_function.json_normalize_to_df(pget_people_subscription_status_df_json, sep='__')
temp_df['people_id'] = people_id temp_df['people_id'] = people_id
get_people_subscription_status_df = pd.concat([temp_df,get_people_subscription_status_df], ignore_index=True) get_people_subscription_status_df = pd.concat([temp_df,get_people_subscription_status_df], ignore_index=True)