Commit 6cf4951a by fangxingjun

no message

parent 4b3ec9ba
...@@ -19,9 +19,11 @@ if __name__ == '__main__': ...@@ -19,9 +19,11 @@ if __name__ == '__main__':
d1, d2 = CommonUtil.split_month_week_date(date_type, date_info) d1, d2 = CommonUtil.split_month_week_date(date_type, date_info)
d2 = f'0{d2}' if int(d2) < 10 else f'{d2}' d2 = f'0{d2}' if int(d2) < 10 else f'{d2}'
db_type = 'postgresql_14' db_type = 'postgresql_14'
import_table = f"{site_name}_asin_detail_month_{d1}_{d2}" # import_table = f"{site_name}_asin_detail_month_{d1}_{d2}"
if date_type == 'day': # if date_type == 'day':
import_table = f"{site_name}_asin_detail_day_{date_info.replace('-', '_')}" # import_table = f"{site_name}_asin_detail_day_{date_info.replace('-', '_')}"
import_table = f"{site_name}_asin_detail_{date_type}_{date_info.replace('-', '_')}"
check_table = f"{site_name}_all_syn_st_{date_type}_{date_info.replace('-', '_')}"
hive_table = "ods_asin_detail" hive_table = "ods_asin_detail"
partition_dict = { partition_dict = {
"site_name": site_name, "site_name": site_name,
...@@ -49,7 +51,7 @@ if __name__ == '__main__': ...@@ -49,7 +51,7 @@ if __name__ == '__main__':
def check_syn(engine): def check_syn(engine):
while True: while True:
try: try:
sql_check_syn = f"select * from {import_table} where state in (1, 2) limit 100" sql_check_syn = f"select * from {check_table} where state in (1, 2) limit 100"
df = engine.read_sql(sql_check_syn) df = engine.read_sql(sql_check_syn)
if df.shape[0] > 0: if df.shape[0] > 0:
print(f"爬虫还未抓完, 等待5分钟继续") print(f"爬虫还未抓完, 等待5分钟继续")
......
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