fix(sqlalchemy): убрать :name::type — psycopg3 их не парсит, ломает Phase A INSERT в kn_scrape_runs (run_region_sweep крашится сразу с ProgrammingError, task_received записан, но run_id никогда не создаётся). 4 места: domrf_kn.py (resume INSERT, new run INSERT, snapshot UPDATE) + admin_leads.py (date_to filter). Заменено на CAST(:name AS type).
This commit is contained in:
parent
c3bc96535d
commit
d1f2380f32
2 changed files with 5 additions and 5 deletions
|
|
@ -67,7 +67,7 @@ def list_leads(
|
||||||
where.append("l.created_at >= :date_from")
|
where.append("l.created_at >= :date_from")
|
||||||
params["date_from"] = date_from
|
params["date_from"] = date_from
|
||||||
if date_to:
|
if date_to:
|
||||||
where.append("l.created_at < (:date_to::date + INTERVAL '1 day')")
|
where.append("l.created_at < (CAST(:date_to AS date) + INTERVAL '1 day')")
|
||||||
params["date_to"] = date_to
|
params["date_to"] = date_to
|
||||||
if search:
|
if search:
|
||||||
where.append("(l.name ILIKE :search OR l.phone_last4 = :exact_search)")
|
where.append("(l.name ILIKE :search OR l.phone_last4 = :exact_search)")
|
||||||
|
|
|
||||||
|
|
@ -1021,8 +1021,8 @@ async def run_region_sweep(
|
||||||
total_obj_count, heartbeat_at, resumed_from_run_id
|
total_obj_count, heartbeat_at, resumed_from_run_id
|
||||||
)
|
)
|
||||||
VALUES (
|
VALUES (
|
||||||
:rc::int[], :devs::text[], :snap, 'running',
|
CAST(:rc AS int[]), CAST(:devs AS text[]), :snap, 'running',
|
||||||
:params::jsonb, :objs::jsonb, :idx,
|
CAST(:params AS jsonb), CAST(:objs AS jsonb), :idx,
|
||||||
:total, NOW(), :prev
|
:total, NOW(), :prev
|
||||||
)
|
)
|
||||||
RETURNING run_id
|
RETURNING run_id
|
||||||
|
|
@ -1057,7 +1057,7 @@ async def run_region_sweep(
|
||||||
)
|
)
|
||||||
VALUES (
|
VALUES (
|
||||||
ARRAY[:rc]::int[], CAST(:devs AS text[]), :snap, 'running',
|
ARRAY[:rc]::int[], CAST(:devs AS text[]), :snap, 'running',
|
||||||
:params::jsonb, NOW()
|
CAST(:params AS jsonb), NOW()
|
||||||
)
|
)
|
||||||
RETURNING run_id
|
RETURNING run_id
|
||||||
"""
|
"""
|
||||||
|
|
@ -1141,7 +1141,7 @@ async def run_region_sweep(
|
||||||
text(
|
text(
|
||||||
"""
|
"""
|
||||||
UPDATE kn_scrape_runs
|
UPDATE kn_scrape_runs
|
||||||
SET objects_snapshot = :objs::jsonb,
|
SET objects_snapshot = CAST(:objs AS jsonb),
|
||||||
total_obj_count = :total,
|
total_obj_count = :total,
|
||||||
objects_count = :total,
|
objects_count = :total,
|
||||||
heartbeat_at = NOW()
|
heartbeat_at = NOW()
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue