feat: 新增单位工程级工料机汇总(lme_uw)并将项目工料机数据源切换为项目级汇总
This commit is contained in:
28
release/testdata/probe_db.py
vendored
28
release/testdata/probe_db.py
vendored
@@ -1,22 +1,34 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""最小探针:定位哪个库、哪种打开方式能读。只读 SELECT。"""
|
||||
import glob
|
||||
"""最小探针:定位哪个库、哪种打开方式能读。只读 SELECT。
|
||||
2026-10-11:路径改走 gen_testdata.find_data_dir()(旧 glob 指向改名前的目录必 IndexError)。"""
|
||||
import os
|
||||
import sqlite3
|
||||
import sys
|
||||
|
||||
sys.stdout.reconfigure(errors="replace")
|
||||
HERE = os.path.dirname(os.path.abspath(__file__))
|
||||
sys.path.insert(0, HERE)
|
||||
import gen_testdata as G
|
||||
|
||||
base = glob.glob("D:/Pricing review*/\u9020\u4ef7\u5ba1\u6838/data")[0]
|
||||
dd = G.find_data_dir()
|
||||
if not dd:
|
||||
print("!! 找不到数据目录(history.db)。请先在控制台里指定,或放到母体旁。")
|
||||
sys.exit(1)
|
||||
rh, th, rs, ts = G.db_paths(dd)
|
||||
targets = {
|
||||
"history.db(真实)": base + "/history.db",
|
||||
"history-test.db": base + "/history-test.db",
|
||||
"session.db(真实)": base + "/session.db",
|
||||
"session-test.db": base + "/session-test.db",
|
||||
"history.db(真实)": rh,
|
||||
"history-test.db": th,
|
||||
"session.db(真实)": rs,
|
||||
"session-test.db": ts,
|
||||
}
|
||||
for name, p in targets.items():
|
||||
if not os.path.exists(p):
|
||||
print("%-18s 缺文件" % name)
|
||||
continue
|
||||
for mode, uri in (("普通", False), ("ro", True)):
|
||||
try:
|
||||
con = sqlite3.connect(p if not uri else "file:" + p.replace("\\", "/") + "?mode=ro", uri=uri, timeout=5)
|
||||
con = sqlite3.connect(p if not uri else "file:" + p.replace("\\", "/") + "?mode=ro",
|
||||
uri=uri, timeout=5)
|
||||
n = con.execute("SELECT COUNT(*) FROM sqlite_master").fetchone()[0]
|
||||
con.close()
|
||||
print("%-18s %-4s OK, sqlite_master=%d" % (name, mode, n))
|
||||
|
||||
Reference in New Issue
Block a user