B1 服务端自动挑剖析表不再挑中一批空表:候选里还有待核实(推断)关系的表排在前面,再按使用次数、表结构顺序;挑表时先估行数,确知是空表的跳过并记进 empty_tables(最多估 30 张、最多用掉查询次数上限的一半),估行数的查询算进这张表的查询数;候选全是空表时说明写明是空表

This commit is contained in:
ThearchyHelios
2026-10-04 02:03:36 +08:00
parent 661f6a38d7
commit 99ca98a87d
4 changed files with 125 additions and 9 deletions
+6 -1
View File
@@ -292,7 +292,10 @@ async def profile_catalog_tables(source_id: str, payload: CatalogProfileIn,
raise HTTPException(409, str(e)) from e
rows = [_profile_table_out(t) for t in report.tables]
note = None
if not rows:
if not rows and report.empty_tables:
note = (f"有待核对关联关系的 {len(report.empty_tables)} 张表都是空表,没有可以核实的数据。"
"请在数据有了之后再剖析,或指定要剖析的表")
elif not rows:
note = "目录里还没有待核实的关联关系,请先起草数据目录,或指定要剖析的表"
return {
"profiled_at": report.profiled_at,
@@ -302,6 +305,8 @@ async def profile_catalog_tables(source_id: str, payload: CatalogProfileIn,
"stopped": report.stopped,
"tables": rows,
"total": {k: sum(r[k] for r in rows) for k in ("added", "updated", "removed")},
# 不指定表时挑表途中确知是空表、跳过了的表(指定了表时总是空列表)
"empty_tables": report.empty_tables,
"note": note,
}