refactor(db)!: clean up business SQL access

- make realtime replacement and analysis result writes transactional\n- consolidate SCADA repositories and remove process-global project state\n- validate SCADA batches and use indexed GIS-backed business queries\n\nBREAKING CHANGE: remove the public analysis result writer and the pipeline-health network_name query parameter.
This commit is contained in:
2026-08-28 11:37:36 +08:00
parent b74799a39d
commit 9b095c7439
34 changed files with 859 additions and 921 deletions
+3 -3
View File
@@ -1,7 +1,7 @@
import ast
from pathlib import Path
from app.infra.db.postgresql import scada_assets
from app.infra.db.postgresql import scada
from app.native.wndb.core.database import ChangeSet, sql_literal
from app.native.wndb.gis import coordinates
from app.native.wndb.model import controls, junctions, patterns
@@ -48,9 +48,9 @@ def test_get_all_scada_info_reads_materialized_view(monkeypatch) -> None:
statements.append(statement)
return []
monkeypatch.setattr(scada_assets, "read_all", fake_read_all)
monkeypatch.setattr(scada, "read_all", fake_read_all)
assert scada_assets.get_all_scada_info("project_a") == []
assert scada.get_all_scada_info("project_a") == []
assert "FROM gis.scada_devices" in statements[0]