|
@@ -41,22 +41,22 @@ def check_data(project, table, partitionDt, partitionDtHh) -> int:
|
|
|
t = odps.get_table(name=table)
|
|
|
# check_res = t.exist_partition(partition_spec=f'dt={partition}')
|
|
|
# 含有hh分区
|
|
|
- if not {partitionDtHh}:
|
|
|
- check_res = t.exist_partition(partition_spec=f'dt={partitionDt},hh={partitionDtHh}')
|
|
|
- if check_res:
|
|
|
- sql = f'select * from {project}.{table} where dt = {partitionDt} and hh={partitionDtHh}'
|
|
|
- with odps.execute_sql(sql=sql).open_reader() as reader:
|
|
|
- data_count = reader.count
|
|
|
- else:
|
|
|
- data_count = 0
|
|
|
+ # if not {partitionDtHh}:
|
|
|
+ check_res = t.exist_partition(partition_spec=f'dt={partitionDt},hh={partitionDtHh}')
|
|
|
+ if check_res:
|
|
|
+ sql = f'select * from {project}.{table} where dt = {partitionDt} and hh={partitionDtHh}'
|
|
|
+ with odps.execute_sql(sql=sql).open_reader() as reader:
|
|
|
+ data_count = reader.count
|
|
|
else:
|
|
|
- check_res = t.exist_partition(partition_spec=f'dt={partitionDt}')
|
|
|
- if check_res:
|
|
|
- sql = f'select * from {project}.{table} where dt = {partitionDt}'
|
|
|
- with odps.execute_sql(sql=sql).open_reader() as reader:
|
|
|
- data_count = reader.count
|
|
|
- else:
|
|
|
- data_count = 0
|
|
|
+ data_count = 0
|
|
|
+ # else:
|
|
|
+ # check_res = t.exist_partition(partition_spec=f'dt={partitionDt}')
|
|
|
+ # if check_res:
|
|
|
+ # sql = f'select * from {project}.{table} where dt = {partitionDt}'
|
|
|
+ # with odps.execute_sql(sql=sql).open_reader() as reader:
|
|
|
+ # data_count = reader.count
|
|
|
+ # else:
|
|
|
+ # data_count = 0
|
|
|
except Exception as e:
|
|
|
print("error:" + str(e))
|
|
|
data_count = 0
|