fix(cadastre,nspd_sync): SQL syntax bugs surfaced by ekb_full v2
Three distinct SQL syntax errors caught from worker logs: 1. **upsert_zouit** (bulk_harvest.py:940) — trailing comma after 4326 in ST_Transform(..., 3857), 4326,) → 'syntax error at or near ")"'. Hit on 8+ quarters in 0108 block (66:41:0108055/61/69/77 etc). Likely introduced by ruff-format auto-comma on closing paren. 2. **nspd_sync** (nspd_sync.py:120) — `:fetched_at_utc::timestamptz` psycopg double-colon trap → 'syntax error at or near ":"'. Crashed legacy on-demand harvest_quarter called from analyze. 3. **job_settings** (job_settings.py:224) — `:extra_config::jsonb` same double-colon trap in admin settings UPDATE. All converted to CAST(:x AS type) pattern (psycopg v3 safe). 40 tests still passing.
This commit is contained in:
parent
5f8df655cc
commit
d445240e6f
3 changed files with 3 additions and 3 deletions
|
|
@ -937,7 +937,7 @@ def upsert_zouit(db: Session, feature: NSPDBulkFeature, source: str = "search")
|
|||
ST_Multi(
|
||||
ST_Transform(
|
||||
ST_SetSRID(ST_GeomFromGeoJSON(CAST(:geom AS text)), 3857),
|
||||
4326,
|
||||
4326
|
||||
)
|
||||
)
|
||||
ELSE NULL END,
|
||||
|
|
|
|||
|
|
@ -221,7 +221,7 @@ def update(
|
|||
params["rate_ms"] = rate_ms if rate_ms > 0 else None
|
||||
|
||||
if extra_config is not None:
|
||||
sets.append("extra_config = :extra_config::jsonb")
|
||||
sets.append("extra_config = CAST(:extra_config AS jsonb)")
|
||||
import json
|
||||
|
||||
params["extra_config"] = json.dumps(extra_config, ensure_ascii=False)
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ _UPSERT_SQL = text(
|
|||
:red_lines_count, :engineering_count, :zouit_count, :risks_count, :total_features,
|
||||
CAST(:features_json AS jsonb),
|
||||
CAST(:layers_fetched AS text[]),
|
||||
:fetched_at_utc::timestamptz,
|
||||
CAST(:fetched_at_utc AS timestamptz),
|
||||
:harvest_duration_ms,
|
||||
:harvest_error,
|
||||
:region_code
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue