Quellcode durchsuchen

vov用于过滤的特征

zhangbo vor 7 Monaten
Ursprung
Commit
6b7e80696b
1 geänderte Dateien mit 4 neuen und 4 gelöschten Zeilen
  1. 4 4
      write_redis/alg_recsys_task_doudi_videos.py

+ 4 - 4
write_redis/alg_recsys_task_doudi_videos.py

@@ -42,10 +42,10 @@ def check_data(project, table,  date, hour, mm) -> int:
     )
     try:
         t = odps.get_table(name=table)
-        log_.info(f"检查分区是否存在-dt={date}")
-        check_res = t.exist_partition(partition_spec=f'dt={date}')
+        log_.info(f"检查分区是否存在-dt={date}.{hour}")
+        check_res = t.exist_partition(partition_spec=f'dt={date},hour={hour},minute={hour}0000')
         if check_res:
-            sql = f'select * from {project}.{table} where dt = {date} and hour = \"{hour}\" and minute = \"{hour}0000\"'
+            sql = f'select * from {project}.{table} where dt = \"{date}\" and hour = \"{hour}\" and minute = \"{hour}0000\"'
             log_.info(sql)
             with odps.execute_sql(sql=sql).open_reader() as reader:
                 data_count = reader.count
@@ -53,7 +53,7 @@ def check_data(project, table,  date, hour, mm) -> int:
             log_.info("表{}分区{}不存在".format(table, date + hour))
             data_count = 0
     except Exception as e:
-        log_.error("table:{},date:{} no data. return data_count=0,报错原因是:{}".format(table, date, hour, e))
+        log_.error("table:{},date:{}.{} no data. return data_count=0,报错原因是:{}".format(table, date, hour, e))
         data_count = 0
     return data_count