Commit 35da7e22 by fangxingjun

no message

parent eb17e1ed
...@@ -17,6 +17,8 @@ date_type = sys.argv[2] # 参数2:类型:day/week/4_week/month/quarter ...@@ -17,6 +17,8 @@ date_type = sys.argv[2] # 参数2:类型:day/week/4_week/month/quarter
date_info = sys.argv[3] # 参数3:年-月-日/年-周/年-月/年-季, 比如: 2022-1 date_info = sys.argv[3] # 参数3:年-月-日/年-周/年-月/年-季, 比如: 2022-1
db_type = "mysql" db_type = "mysql"
if date_type == 'week':
db_type = 'doris'
engine = get_remote_engine( engine = get_remote_engine(
site_name=site_name, site_name=site_name,
...@@ -29,20 +31,33 @@ partition_dict = { ...@@ -29,20 +31,33 @@ partition_dict = {
"date_type": date_type, "date_type": date_type,
"date_info": date_info, "date_info": date_info,
} }
sql_query = f"select id, request_id, asin, tracking_since from keepa_finder_asin where 1=1 " \
f"and \$CONDITIONS"
is_saturday_flag = is_saturday(date_info)
if is_saturday_flag: if date_type == 'week':
print(f"{date_info}是周六, 因此需要进行导入") # db_type = 'doris'
sql_query = f"select null as id, null as request_id, asin, update_time as tracking_since from keepa_finder_asin where 1=1 " \
f"and \$CONDITIONS"
engine.sqoop_raw_import( engine.sqoop_raw_import(
query=sql_query, query=sql_query,
hive_table=hive_table, hive_table=hive_table,
partitions=partition_dict, partitions=partition_dict,
m=1, m=1,
) )
else: else:
print(f"{date_info}不是周六, 因此不需要进行导入") sql_query = f"select id, request_id, asin, tracking_since from keepa_finder_asin where 1=1 " \
f"and \$CONDITIONS"
is_saturday_flag = is_saturday(date_info)
if is_saturday_flag:
print(f"{date_info}是周六, 因此需要进行导入")
engine.sqoop_raw_import(
query=sql_query,
hive_table=hive_table,
partitions=partition_dict,
m=1,
)
else:
print(f"{date_info}不是周六, 因此不需要进行导入")
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