瀏覽代碼

feat:添加校验AD数据方法

zhaohaipeng 9 月之前
父節點
當前提交
75c94e7878
共有 1 個文件被更改,包括 4 次插入3 次删除
  1. 4 3
      zhangbo/utils.py

+ 4 - 3
zhangbo/utils.py

@@ -35,7 +35,7 @@ def check_data(project, table, partition) -> int:
     return data_count
 
 
-def check_data_hh(project, table, partition) -> int:
+def check_data_hh(project, table, partition, hh) -> int:
     """检查数据是否准备好,输出数据条数"""
     odps = ODPS(
         access_id=ODPS_CONFIG['ACCESSID'],
@@ -49,7 +49,7 @@ def check_data_hh(project, table, partition) -> int:
     )
     try:
         t = odps.get_table(name=table)
-        check_res = t.exist_partition(partition_spec=f'dt={partition},hh=0')
+        check_res = t.exist_partition(partition_spec=f'dt={partition},hh={hh}')
         if check_res:
             sql = f'select * from {project}.{table} where dt = {partition}'
             with odps.execute_sql(sql=sql).open_reader() as reader:
@@ -108,7 +108,8 @@ def check_ad_origin_hive(args):
     project = "loghubods"
     table = "alg_recsys_ad_sample_all_new"
     partition = args.partition
-    count = check_data_hh(project, table, partition)
+    hh = args.hh
+    count = check_data_hh(project, table, partition, hh)
     if count == 0:
         print("1")
         exit(1)