Commit 34dfe2ab by fangxingjun

no message

parent 9c3b513a
...@@ -42,10 +42,13 @@ class DwtThemeBsOrders(Templates): ...@@ -42,10 +42,13 @@ class DwtThemeBsOrders(Templates):
# f"union all " \ # f"union all " \
# f"select asin, asin_title, bsr_orders, date_info from dwt_flow_asin where site_name='{self.site_name}' and " \ # f"select asin, asin_title, bsr_orders, date_info from dwt_flow_asin where site_name='{self.site_name}' and " \
# f"date_type='month' and date_info in ('2023-01', '2023-02', '2023-03', '2023-04', '2023-05', '2023-06');" # f"date_type='month' and date_info in ('2023-01', '2023-02', '2023-03', '2023-04', '2023-05', '2023-06');"
sql = f"select asin, asin_title, bsr_orders, date_info from dwt_flow_asin where site_name='{self.site_name}' and " \ # sql = f"select asin, asin_title, bsr_orders, date_info from dwt_flow_asin where site_name='{self.site_name}' and " \
f"date_type='month' and date_info >= '2023-01' and date_info <= '2023-12';" # f"date_type='month' and date_info >= '2023-01' and date_info <= '2023-12';"
# f"date_type='month' and date_info >= '2023-01' and date_info <= '2023-01' limit 1000000;" # f"date_type='month' and date_info >= '2023-01' and date_info <= '2023-01' limit 1000000;"
sql = f"select asin, asin_title, bsr_orders, date_info from dwt_flow_asin where site_name='{self.site_name}' and " \
f"date_type='month' and date_info >= '2024-08' and date_info <= '2025-07';"
print("sql:", sql) print("sql:", sql)
self.df_flow = self.spark.sql(sql).cache() self.df_flow = self.spark.sql(sql).cache()
self.df_flow.show(10, truncate=False) self.df_flow.show(10, truncate=False)
...@@ -186,7 +189,8 @@ class DwtThemeBsOrders(Templates): ...@@ -186,7 +189,8 @@ class DwtThemeBsOrders(Templates):
self.df_save = self.df_save.cache() self.df_save = self.df_save.cache()
self.df_save.show(50, truncate=False) self.df_save.show(50, truncate=False)
df = self.df_save.toPandas() df = self.df_save.toPandas()
df.to_csv("/root/theme_new_2023.csv", index=False) # df.to_csv("/root/theme_new_2023.csv", index=False)
df.to_csv("/home/fangxingjun/theme_new_202408-202507.csv", index=False)
if __name__ == '__main__': if __name__ == '__main__':
......
...@@ -12,7 +12,7 @@ sys.path.append(os.path.dirname(sys.path[0])) ...@@ -12,7 +12,7 @@ sys.path.append(os.path.dirname(sys.path[0]))
def get_redis_h14(): def get_redis_h14():
return redis.Redis(host='192.168.10.224', port=6379, db=9, password='fG7#vT6kQ1pX') return redis.Redis(host='192.168.10.224', port=6379, db=9, password='N8#rTp2Xz!Lk6@Vw9qHs4&Yb1Fm0Cj3')
class DbTypes(Enum): class DbTypes(Enum):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment